Jump to content

Need help installing my widget code script - code blocks not working

Go to solution Solved by paul2009,

Recommended Posts

Site URL: https://www.signaturesmiles-nc.com/request-appointment-1

Hello!

I'm trying to install the following widget code script  but it's not working in the code block. The company's tech support says it's a plug and play solution and that they have lots of SQSP users but I can't seem to make it work. Any help would be much appreciated:

 

<script src="https://d3ivs86j8l3a5r.cloudfront.net/flexBook.js"></script>

initFlexBook('https://flexbook.me/sigsmiles')

 

 

Link to comment

@tuanphanThanks so much for replying...it's not currently on the page as it's not working in the code block, embed block or header page injection..

Got it from a company called Flex who do dental appointment scheduling. They seem to say its a plug and play solution but it doens't work. I'll readd it to the page so you can see how its interacting.

 

Link to comment
16 hours ago, nickcharliekey said:

@tuanphanThanks so much for replying...it's not currently on the page as it's not working in the code block, embed block or header page injection..

Got it from a company called Flex who do dental appointment scheduling. They seem to say its a plug and play solution but it doens't work. I'll readd it to the page so you can see how its interacting.

 

I think this code (in red box) should have an opening & closing tag (something like this <script>initFlexBook('https://flexbook.me/sigsmiles');</script>)

Can you check again?

this-code.png.d2daf9d6e55781870f358d2a74d258a1.png

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
  • Solution
1 hour ago, nickcharliekey said:

it forces a popup on page load, is there anyway to make it open on a click, either by button or have it appear in an iframe perhaps?

Yes, you should be able to do either of these!

iframe

To use an iframe, simply add the link (https://flexbook.me/sigsmiles) to some simple iframe code inside a Code Block. You won't need the rest of the code that you quoted above. For example, this should be all you need:

<iframe src="//flexbook.me/sigsmiles" width="100%" height="985px" style="border:none;">
</iframe>

Click button

To launch the popup from a button in the header, add a new 'Link" to the navigation in the same position (replacing the page). You can remove the code block.

Set the URL of the new navigation link to "#". Then you'll need to add a few lines of code to Settings > Advanced > Code Injection > Footer:

<script src="https://d3ivs86j8l3a5r.cloudfront.net/flexBook.js"></script>
<script>
  apptBtn = document.querySelector(".horizontal-navigation-bar nav > ul > li:last-child");
  apptBtn.addEventListener("click", function() {
    initFlexBook('https://flexbook.me/sigsmiles')
  });
</script>

Once saved, this should launch the popup like this:

appt-button-book.gif.3b2f846476119a95beb49f46b5ead210.gif

Note: Like all the code posted on this forum, this is a simplified example. It has been provided without warranty. For a supported solution from a professional developer, I recommend booking a Squarespace Expert.

Edited by paul2009

About me: I've been a SQSP User for 18 yrs. I was invited to join the Circle when it launched in 2016. I have been a Circle Leader since 2017. I don't work for Squarespace. I value honesty, transparency, diversity and good design ♥.
Work: I founded and run SF.DIGITAL, building Squarespace Extensions to supercharge your commerce website. 
Content: Views and opinions are my own. Links in my posts may refer to SF.DIGITAL products or may be affiliate links.
Forum advice is free. You can thank me by clicking one of the feedback emojis below. Coffee is optional.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.