Jump to content

Script in Code Block is running in edit mode, but not on live site.

Recommended Posts

Site URL: http://lemastersfitness.com

My client brought to my attention that the drop-down/accordions on his 'Get Coached' page had stopped working (dropping down). When I went to edit the site, I noticed that the usual 'Embedded Scripts' warning was not present over that code block. I opened up the block, reviewed the code (which hadn't changed), and then saved it just to be sure - and the warning rendered. 
I opened a private browser window to verify that it had indeed fixed the issue on the live site, and it did - but then as soon as I close the squarespace editor and asked him to confirm it for me, he noted that it had stopped working again (which I then confirmed in my own private browser window). 

This is changed behavior; I can't say specifically as of when, since I'm sure he doesn't click those accordions on a regular basis, but I can say it worked fine as of 6 months ago when I finished that page for him. The best I can tell, it seems like SS is not recognizing or running the script in the code block - except when i'm in edit mode, which is when it shouldn't run it. I can provide screenshots/capture videos if helpful. 

I did do some searching before posting, but most of what I saw relative to broken Javascript was related to the newer AJAX functionality, which I disabled just to be sure, but wasn't the issue. Is this a bug in SS platform? Or am I missing something?

Link to comment
1 minute ago, tuanphan said:

Have you solved yet? If no, I can take a look

 

I have not, been working on other stuff for the last day. I did confirm that the script i have in the code block is definitely not in the live site: inspected the elements, the HTML content and the style tags are there, but not the script tag. Which seems to kind of confirm that SS is not parsing/recognizing the script tag in the code block - but I really don't know the intricacies of how SS operates.

For the record, I'm a front-end app developer by day, so if this gets technical don't be shy 👍 

Link to comment
6 minutes ago, subtletale said:

I have not, been working on other stuff for the last day. I did confirm that the script i have in the code block is definitely not in the live site: inspected the elements, the HTML content and the style tags are there, but not the script tag. Which seems to kind of confirm that SS is not parsing/recognizing the script tag in the code block - but I really don't know the intricacies of how SS operates.

For the record, I'm a front-end app developer by day, so if this gets technical don't be shy 👍 

strange, just test on my site, seems works

https://robin-triangle-z47x.squarespace.com/test?password=abc

pass abc

--

Also, if you want to create accordion/tab, try this plugin, easy to do/customize without code skill, works great.

Edited by tuanphan

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

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

Link to comment

@subtletale This appears to be an Ajax Page Loading issue, specific to Squarespace. I checked and Ajax appears to be on.

Improve your online store with our extensions.
About: Squarespace Circle Leader since 2017. I value honesty, transparency, appreciation and great design ♥.
Work: Squarespace Developer and founder of SF Digital, building the features Squarespace didn't include™.
Content: Links in my posts may refer to SF Digital products or may be affiliate links.

Buy me a coffee

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.