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

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, 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

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, 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 me: I'm Paul, a SQSP user for over 18 yrs and a Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF.DIGITAL, providing high quality original extensions to supercharge your Squarespace website. 
Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links.
Forum advice is completely free. You can thank me by selecting a feedback emoji below. Buying a coffee is optional.

Book paid help with domains: Connect a GoDaddy domain. Connect a Squarespace Domain. Domain assistance

Link to comment
  • 1 year later...

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.