Jump to content

7.1 Javascript in Squarespace isn't working?

Recommended Posts

Hi,

I want to embed a zoho form on my landing page.
Unfortunately, I can't use iframe because in the mobile view the form is cut off.

I would like to try it with JavaScript but I can't insert the code in the code block - it appears simply as code (see screenshot).

Who knows what to do? 

This is the code I wand to embed:
 

Quote

<div id="zf_div_EuPWAJbU6VZQc1E1HHbrEpXtqYfrcVNPG_u-zsP9TtI"></div><script type="text/javascript">(function() {
try{
var f = document.createElement("iframe");   
f.src = 'https://forms.zohopublic.eu/inneco/form/Neugierig/formperma/EuPWAJbU6VZQc1E1HHbrEpXtqYfrcVNPG_u-zsP9TtI?zf_rszfm=1';
f.style.border="none";                                           
f.style.height="500px";
f.style.width="90%";
f.style.transition="all 0.5s ease";// No I18N
var d = document.getElementById("zf_div_EuPWAJbU6VZQc1E1HHbrEpXtqYfrcVNPG_u-zsP9TtI");
d.appendChild(f);
window.addEventListener('message', function (){
var zf_ifrm_data = event.data.split("|");
var zf_perma = zf_ifrm_data[0];
var zf_ifrm_ht_nw = ( parseInt(zf_ifrm_data[1], 10) + 15 ) + "px";
var iframe = document.getElementById("zf_div_EuPWAJbU6VZQc1E1HHbrEpXtqYfrcVNPG_u-zsP9TtI").getElementsByTagName("iframe")[0];
if ( (iframe.src).indexOf('formperma') > 0 && (iframe.src).indexOf(zf_perma) > 0 ) {
var prevIframeHeight = iframe.style.height;
if ( prevIframeHeight != zf_ifrm_ht_nw ) {
iframe.style.height = zf_ifrm_ht_nw;
}   
}
}, false);
}catch(e){}
})();</script>

 

Bildschirmfoto 2020-12-18 um 14.28.06.png

Edited by ando_337
Link to comment
16 hours ago, ando_337 said:

Site URL: https://www.inneco.de/eco-basic-eco-premium

Hi,

I want to embed a zoho form on my landing page.
Unfortunately, I can't use iframe because in the mobile view the form is cut off.

I would like to try it with JavaScript but I can't insert the code in the code block - it appears simply as code (see screenshot).

Who knows what to do? 

This is the code I wand to embed:
 

 

Bildschirmfoto 2020-12-18 um 14.28.06.png

Uncheck the first rectangle and turn the downdown to HTML

image.png.b2b4273c05168d00b76b323a93e4f476.png

Greeting, it's 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, Delivery Date Picker, Lightbox Studio plugin
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 comment
1 minute ago, ando_337 said:

@bangank36 I did, but than it says script disabled:

 

Bildschirmfoto 2020-12-19 um 15.19.53.png

Script disabled in editor mode, it run on live site, did you have business plan

Greeting, it's 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, Delivery Date Picker, Lightbox Studio plugin
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 comment
  • 1 year later...
On 12/19/2020 at 4:23 PM, bangank36 said:

Script disabled in editor mode, it run on live site, did you have business plan

@bangank36 Hi! I am having the same issue with "script disabled" text in editor mode for javascript. I do have business plan and I also selected HTML with same result. Any idea why it  doesn't work?

Edited by SQA
Link to comment
16 hours ago, SQA said:

I am having the same issue with "script disabled" text in editor mode

This is correct in editor mode. To view your site with the script enabled, open the site in a new private (or incognito) browser window where you are not logged into the site. You will now view your site as a visitor does, and scripts should run.

  If this post has helped you, please click a 'Like' or 'Thanks' icon below  ⬇️

About: Squarespace Circle Leader since 2017. I value honesty, transparency, diversity 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.

Catch up on all the release notes and announcements 2023 [for Circle members only]. There's a public version here too!
If I helped, you can thank me by clicking one of the emojis below. If you prefer, you can buy me a coffee.
Improve your online store with our extensions.

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.