Jump to content

Code to prevent my website from running on Internet Explorer

Go to solution Solved by paul2009,

Recommended Posts

Posted (edited)

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
Posted
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. 

Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF.DIGITAL. We provide 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. Buying a coffee is generous but optional.

Posted
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?

  • Solution
Posted (edited)

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

Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF.DIGITAL. We provide 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. Buying a coffee is generous but optional.

Posted
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.)

Posted (edited)
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

Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF.DIGITAL. We provide 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. Buying a coffee is generous but optional.

Posted
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.

Posted
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

Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF.DIGITAL. We provide 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. Buying a coffee is generous but optional.

Posted
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!!

Posted
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 🙂

Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF.DIGITAL. We provide 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. Buying a coffee is generous but optional.

Posted (edited)
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
Posted (edited)

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

Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF.DIGITAL. We provide 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. Buying a coffee is generous but optional.

Posted

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!

Posted
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.

Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF.DIGITAL. We provide 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. Buying a coffee is generous but optional.

Posted
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 🙂

Posted
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.

Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF.DIGITAL. We provide 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. Buying a coffee is generous but optional.

Posted
On 12/17/2021 at 11:33 PM, paul2009 said:

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

Please try the revised code above.

This works perfectly. Thank you again so much for your generosity with your expertise!!

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.