Jump to content

Code to prevent my website from running on Internet Explorer

Go to solution Solved by paul2009,

Recommended Posts

I'm really hoping someone can help me with this. I'm looking for code (presumably javascript) that will prevent my site from running on Internet Explorer (and instead will show a message similar to the attached image). And if someone could walk me through how to do this, that'd be great - I don't currently have a business account on squarespace, so if I can't do this in a markdown block then I'll just upgrade to a business plan.

Thanks very much in advance!

internet explorer text1.PNG

Edited by RT53
Link to comment
1 minute ago, RT53 said:

I'm looking for code that will prevent my site from running on Internet Explorer. I don't have a business account on squarespace

This is easy to do but you’ll need a Business Plan. 

About me: I've been a SQSP User for 18 yrs. I was invited to join the Circle when it launched in 2016. I have been a Circle Leader since 2017. I don't work for Squarespace. I value honesty, transparency, diversity and good design ♥.
Work: I founded and run SF.DIGITAL, building Squarespace Extensions to supercharge your commerce website. 
Content: Views and opinions are my own. Links in my posts may refer to SF.DIGITAL products or may be affiliate links.
Forum advice is free. You can thank me by clicking one of the feedback emojis below. Coffee is optional.

Link to comment
1 minute ago, paul2009 said:

This is easy to do but you’ll need a Business Plan. 

Hi Paul - thanks very much for your response! I can't just put the code in a markdown block? If not, then I'll just upgrade to business. Would you be able to tell me what to do assuming that I have a business plan?

Link to comment
  • Solution

If you create your informative page, for example a page called called Browser Warning (page with a URL of /browser-warning), you should be able to redirect customers to this page if they are using IE by adding something like this to Settings > Advanced > Code Injection > Header:

<script>
  if (window.location.pathname != "/browser-warning") {
    if (/MSIE|Trident/.test(window.navigator.userAgent)) window.location.href = '/browser-warning';
  }
</script>

However there are free tools available that can help you to inform users of all older browsers with an announcement bar style warning. For more information, take a look at https://browser-update.org/

Edited by paul2009
Updated

About me: I've been a SQSP User for 18 yrs. I was invited to join the Circle when it launched in 2016. I have been a Circle Leader since 2017. I don't work for Squarespace. I value honesty, transparency, diversity and good design ♥.
Work: I founded and run SF.DIGITAL, building Squarespace Extensions to supercharge your commerce website. 
Content: Views and opinions are my own. Links in my posts may refer to SF.DIGITAL products or may be affiliate links.
Forum advice is free. You can thank me by clicking one of the feedback emojis below. Coffee is optional.

Link to comment
24 minutes ago, paul2009 said:

If you create your informative page, for example a page called called Browser Warning (page with a URL of /browser-warning), you should be able to redirect customers to this page if they are using IE by adding something like this to Settings > Advanced > Code Injection > Header:

<script type="application/javascript">
    if (/MSIE|Trident/.test(window.navigator.userAgent)) window.location.href = '/browser-warning';
</script>

However there are free tools available that can help you to inform users of all older browsers with an announcement bar style warning. For more information, take a look at https://browser-update.org/

Hi Paul - this is working great! But the only thing is that it's coming up as a blank page. How do I add text? (I want to tell the user that this browser doesn't support myself and direct them to download chrome, firefox, etc.)

Link to comment
1 hour ago, RT53 said:

this is working great! But the only thing is that it's coming up as a blank page.

Create a new page, give it the name Browser Warning (or change the URL in the code) and add your messages to this page. 

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

Edited by paul2009

About me: I've been a SQSP User for 18 yrs. I was invited to join the Circle when it launched in 2016. I have been a Circle Leader since 2017. I don't work for Squarespace. I value honesty, transparency, diversity and good design ♥.
Work: I founded and run SF.DIGITAL, building Squarespace Extensions to supercharge your commerce website. 
Content: Views and opinions are my own. Links in my posts may refer to SF.DIGITAL products or may be affiliate links.
Forum advice is free. You can thank me by clicking one of the feedback emojis below. Coffee is optional.

Link to comment
17 hours ago, paul2009 said:

Create a new page, give it the name Browser Warning (or change the URL in the code) and add your messages to this page. 

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

But if I add a new page, then it shows up in my navigation bar.  Am I doing something wrong? I just don't know how to add a new page and not have it show on my site.

Link to comment
23 minutes ago, RT53 said:

But if I add a new page, then it shows up in my navigation bar. 

Add the new page to the NOT LINKED section below the MAIN NAVIGATION section. Pages in this section don't appear in the navigation.

newpage-in-not-linked.thumb.jpg.85a7ee0ddbcfe9a327ad5a50cd6e2d55.jpg

About me: I've been a SQSP User for 18 yrs. I was invited to join the Circle when it launched in 2016. I have been a Circle Leader since 2017. I don't work for Squarespace. I value honesty, transparency, diversity and good design ♥.
Work: I founded and run SF.DIGITAL, building Squarespace Extensions to supercharge your commerce website. 
Content: Views and opinions are my own. Links in my posts may refer to SF.DIGITAL products or may be affiliate links.
Forum advice is free. You can thank me by clicking one of the feedback emojis below. Coffee is optional.

Link to comment
59 minutes ago, paul2009 said:

Add the new page to the NOT LINKED section below the MAIN NAVIGATION section. Pages in this section don't appear in the navigation.

newpage-in-not-linked.thumb.jpg.85a7ee0ddbcfe9a327ad5a50cd6e2d55.jpg

Thank you so much! This is perfect.

So now that I made a page for the browser warning message, the page shows my header and footer (and allows for navigation on the site). If you  have time, do you know how I can exclude the header/footer from this page?

Thank you again for sharing your expertise!!

Link to comment
21 minutes ago, RT53 said:

If you have time, do you know how I can exclude the header/footer from this page?

Can you share the URL of the page with me? If the site isn't live yet, you'll also need to set a public password in the visibility settings and share this too 🙂

About me: I've been a SQSP User for 18 yrs. I was invited to join the Circle when it launched in 2016. I have been a Circle Leader since 2017. I don't work for Squarespace. I value honesty, transparency, diversity and good design ♥.
Work: I founded and run SF.DIGITAL, building Squarespace Extensions to supercharge your commerce website. 
Content: Views and opinions are my own. Links in my posts may refer to SF.DIGITAL products or may be affiliate links.
Forum advice is free. You can thank me by clicking one of the feedback emojis below. Coffee is optional.

Link to comment
On 12/16/2021 at 3:13 PM, RT53 said:

Definitely - thank you!

 

 

Ah, the site is also blinking for some reason now that i put in the url for my browser-warning page... not sure how to stop it. 

 

This is the code updated with that page's url:

<script type="application/javascript">
    if (/MSIE|Trident/.test(window.navigator.userAgent)) window.location.href = 'https://www.xxxx-xxxx.com/browser-warning';
</script>
<script> 
var $buoop = {required:{e:-4,f:-3,o:-3,s:-1,c:-3},insecure:true,api:2021.12 }; 
function $buo_f(){ 
 var e = document.createElement("script"); 
 e.src = "//browser-update.org/update.min.js"; 
 document.body.appendChild(e);
};
try {document.addEventListener("DOMContentLoaded", $buo_f,false)}
catch(e){window.attachEvent("onload", $buo_f)}
</script>

Edited by RT53
Link to comment

You should be able to hide the header and footer on this page by adding something like this to Design > Custom CSS:

#collection-61bb17a650cfa105a3b695ee header, #collection-61bb17a650cfa105a3b695ee footer {
  display: none!important;
}

 

Notes:
The blinking should only occur when you are logged on; it's a symptom of the preview window. Visitors won't see it.
The collection ID is specific to this page on your site. Anyone else following this thread will need to identify the ID of their page.

Edited by paul2009

About me: I've been a SQSP User for 18 yrs. I was invited to join the Circle when it launched in 2016. I have been a Circle Leader since 2017. I don't work for Squarespace. I value honesty, transparency, diversity and good design ♥.
Work: I founded and run SF.DIGITAL, building Squarespace Extensions to supercharge your commerce website. 
Content: Views and opinions are my own. Links in my posts may refer to SF.DIGITAL products or may be affiliate links.
Forum advice is free. You can thank me by clicking one of the feedback emojis below. Coffee is optional.

Link to comment

Paul, thank you so much!  So, the header is gone, but the footer is now blank white space (the rest is grey)  - if there's no fix for that then worst case scenario I can just make the whole page white so it blends. But the page is blinking not when I'm logged on - it's blinking when I try to open my site's URL (ie, I'm not logging on to squarespace to access the site, but rather just going straight to my website)... Do you know if there's any fix for this? I hope so!

Link to comment
1 hour ago, RT53 said:

the rest is grey

This is because the page is short. If you make the page longer, by adding empty lines of text or a Spacer Block below the current messages, you should not see this area. 

1 hour ago, RT53 said:

the page is blinking...just going straight to my website

This is a simple code snippet to divert IE users to a warning page as soon as they arrive on the site. As it requires a second page to be loaded (the page containing the message), this will cause the two pages to load in quick succession. This may be what you refer to as 'blinking'. I can write more complex solutions but they would require a longer explanation making them unsuitable for posting on the forum.

About me: I've been a SQSP User for 18 yrs. I was invited to join the Circle when it launched in 2016. I have been a Circle Leader since 2017. I don't work for Squarespace. I value honesty, transparency, diversity and good design ♥.
Work: I founded and run SF.DIGITAL, building Squarespace Extensions to supercharge your commerce website. 
Content: Views and opinions are my own. Links in my posts may refer to SF.DIGITAL products or may be affiliate links.
Forum advice is free. You can thank me by clicking one of the feedback emojis below. Coffee is optional.

Link to comment
1 hour ago, paul2009 said:

This is because the page is short. If you make the page longer, by adding empty lines of text or a Spacer Block below the current messages, you should not see this area. 

This is a simple code snippet to divert IE users to a warning page as soon as they arrive on the site. As it requires a second page to be loaded (the page containing the message), this will cause the two pages to load in quick succession. This may be what you refer to as 'blinking'. I can write more complex solutions but they would require a longer explanation making them unsuitable for posting on the forum.

Ah got it... it blinks repeatedly (like it doesnt stop blinking unless you just close the browser) so then I think I'll just go back to your original script and forgo the text that I wanted to appear.

Thanks for all your help 🙂

Link to comment
25 minutes ago, RT53 said:

Ah got it... it blinks repeatedly

Apologies. That's completely my fault because I didn't test it! 🤪

Please try the revised code above.

About me: I've been a SQSP User for 18 yrs. I was invited to join the Circle when it launched in 2016. I have been a Circle Leader since 2017. I don't work for Squarespace. I value honesty, transparency, diversity and good design ♥.
Work: I founded and run SF.DIGITAL, building Squarespace Extensions to supercharge your commerce website. 
Content: Views and opinions are my own. Links in my posts may refer to SF.DIGITAL products or may be affiliate links.
Forum advice is free. You can thank me by clicking one of the feedback emojis below. Coffee is optional.

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.