Javascript is not loading

Hello, newbie here, so go easy :slight_smile:

I have a bouncy castle hire website www.kingofthecastlescotland.co.uk All my products are displayed in categories with links to individual product pages. On each product page there is a link to check availability and book online. The booking software is provided by a third party and the javascript to begin the booking process is inserted in the header of each product page via Tracking and Analytics. The link to the script is…

Here’s the problem…
When you navigate from the category page to the product page, if the link opens in current window the script does not load and the booking sequence does not display as it should. However, if the same link opens in new window, the JS loads correctly and the booking sequence runs correctly. Interestingly/frustratingly, if you go directly to the URL of the product page, the script loads fine. Likewise, if the current page is refreshed, the script runs correctly.

The developer makes the following observation…
“Regardless of navigation and how you get to that page the problem is the completion of scripts loading on page. Think of it in this way, when the page starts it only loads html first and in html this check availability is a link only, so before the scripts are loaded if you click on it, it will act as a link and open in new tab with calendar view. If you wait for all scripts to load on page (the order can be different based on network and other factors) which can take upto 4-7 seconds and then click on Check availability it would always open correctly”

He’s asked me to ask…

1). Is there any way we can tell that all scripts are loaded?
If there is, can we by default hide this availability link and show it once all scripts are loaded?

2). What could be preventing scripts loading? How do we overcome this?

The category page is www.kingofthecastlescotland.co.uk/bouncy-castles If you click “Greatest Showman Bouncy Castle”, the link opens in New window. Click the ‘Check Availability and Book Now’ link and the booking box open correctly.

Go back to the category page and click “Hey Duggee Bouncy Castle”. This page opens in current view. Click the same ‘Check Availability Box’, and the booking app opens in a new tab, without any of ‘house style’.

I have raised a ticket with Wix Support, who agreed with the observations and were able to replicate the problem. They recommended I post here.

Any help gratefully appreciated.

Regards
Andrew :slight_smile:

The first thing that I have noticed is that your site link to bouncy castles is
https://www.kingofthecastlescotland.co.uk/bouncy-castles.

Whereas, your link to the availability booking page is
Booking

Now note that there is nothing wrong with that, it just indicates that you are using a third party providers html code for this, as you have mentioned in your post itself.

The code snippets that you have used in the Tracking and Analytics section in the new custom tool is not javascript which Wix uses, it is html code.
https://support.wix.com/en/article/embedding-custom-code-to-your-site

Wix does not provide support for technical difficulties associated with third-party code snippets. If you are experiencing an issue with your code snippet, please contact the provider directly.

So please note that Wix do not provide support for third party code, so your best option is to go back to the third party code provider, (which I can take is QuickBooks? ) and ask their own support how to properly integrate this within Wix.

https://support.wix.com/en/article/using-iframes-to-display-visible-content-on-your-site
Important.
We cannot provide support for external codes that were not created or tested with Wix. If you are experiencing an issue with your code snippet, please contact the provider directly.

Also, note that you are posting this in the Wix Corvid Forum and the forum covers all issues that are code related on your site.
https://support.wix.com/en/corvid-by-wix/basics

If you have not used any code on your site, then you are better suited going through Wix Support.
https://support.wix.com/en/about-wix/contacting-wix-customer-care

If you look at QuickBooks own support pages about the booking widget, you will see that it does state issues.
https://support.checkfront.com/hc/en-us/articles/360008055033-Booking-Widget-Generating-the-Web-Code

If you wish to use coded option, then you would be better suited going through their own API and exposing your site to that instead.
https://support.checkfront.com/hc/en-us/articles/360026709133-Checkfront-API-Introduction

You can see an example here from Corvid about exposing a site.
https://www.wix.com/corvid/forum/corvid-tips-and-updates/example-myapi-and-myapiclient

Plus for using Wix Fetch or Wix HTTP Functions, you can read more about it here.
https://support.wix.com/en/article/corvid-accessing-third-party-services-with-the-fetch-api
https://www.wix.com/corvid/reference/wix-fetch.html

https://support.wix.com/en/article/corvid-exposing-a-site-api-with-http-functions
https://www.wix.com/corvid/reference/wix-http-functions.html

Finally, you might have already seen it and not wanted to use it, however Wix already do their own Booking app that you can use for this.
https://support.wix.com/en/wix-bookings/setting-up-wix-bookings
https://support.wix.com/en/corvid-by-wix/wix-bookings-with-corvid
https://www.wix.com/corvid/examples?category=bookings