ArtW 2 Share Posted March 3 Is there a way to call javascript which will only effect the live page, not when it's in the editor? bangank36 1 Link to post
0 bangank36 1,074 Share Posted March 3 5 minutes ago, ArtW said: Is there a way to call javascript which will only effect the live page, not when it's in the editor? Include the script in a function <script> !function(){window.self!=window.top||window.top.document.getElementById("your-script-name")||function(e,t,s,i,a){if(s.querySelector("#"+t))i&&i(this);else{var n=document.createElement("script");n.src=e+"?cache="+((new Date).getTime()+"").substr(0,8),n.id=t,n.onload=function(){a&&this.remove(),i&&i(this)},s.appendChild(n)}}("your-script-url","your-script-name",window.top.document.getElementsByTagName("head")[0])}(); </script> Greeting, it's BaNgan from BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, 360 Degree Photo block, Seperator Block (SVG Shape divider for sections)If you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you Link to post
0 ArtW 2 Author Share Posted March 3 Doesn't that require me adding in the static script resource url instead though? Link to post
0 bangank36 1,074 Share Posted March 3 5 minutes ago, ArtW said: Doesn't that require me adding in the static script resource url instead though? The script contain condition to not add the snippet into the page when in editor mode Greeting, it's BaNgan from BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, 360 Degree Photo block, Seperator Block (SVG Shape divider for sections)If you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you Link to post
Question
ArtW 2
Is there a way to call javascript which will only effect the live page, not when it's in the editor?
Link to post
Top Posters For This Question
2
2
Popular Days
Mar 3
4
Top Posters For This Question
ArtW 2 posts
bangank36 2 posts
Popular Days
Mar 3 2021
4 posts
Popular Posts
ArtW
Is there a way to call javascript which will only effect the live page, not when it's in the editor?
3 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment