• Sign in to Neowin Faster!

    Create an account on Neowin to contribute and support the site.

  • 0
Sign in to follow this  

[HTML] Block Internet Explorer and divert to a different page

Question

CPressland    176

Hey all what's up?

I've made some pretty heavy modifications to one of my PHPBB3 bulletin boards and now Internet Explorer 6 can no longer load the site without some... amusing errors. Internet Explorer 7 sometimes loads, sometimes does not, How very... Microsoft.

Anyway, basically I'd like to cause all Internet Explorer 5.5, 6 and 7 clients to automatically divert to a page for example "ie/blocked.html"

Could anyone recommend or explain how I can go about achieving it?

Thanks

Asphyxia8489

Share this post


Link to post
Share on other sites

Recommended Posts

  • 0
Geoffrey B.    1,415

function scan() {

var ver=navigator.appVersion;

var isMSIE = (!(window.opera) && ver.indexOf("MSIE") != -1) ? 1 : 0;

if (isMSIE) {

alert("This link will not work in Internet Explorer");

...do stuff here ...

}

Share this post


Link to post
Share on other sites
  • 0
CPressland    176

Well, my JS is poop, I can't remember it at all. But that doesn't seam to do what I'd like it to do. I can't see it diverting off at all.

Thanks anyway :)

Share this post


Link to post
Share on other sites
  • 0
Mike    89

How about actually fixing the errors rather than alienating a large portion of users?

Share this post


Link to post
Share on other sites
  • 0
CPressland    176

Because, only 22% of my site's visitors are IE based according to AWSTATS on my server ;)

Firefox is by far the winner, but people NEED to be made aware that IE6 is no longer an valid browser, I'm not working my ass off to give them something for free. If they need the material my site provides, they can do the work ;)

Share this post


Link to post
Share on other sites
  • 0
Mike    89

22% is still quite a proportion and IE6 is still a perfectly valid browser. What site is it that you've made that won't work in IE6?

Share this post


Link to post
Share on other sites
  • 0
+jamesyfx    362

There must be some major problems in your code if it's that bad you have to block the entire browser.

Share this post


Link to post
Share on other sites
  • 0
C_Guy    8
How about actually fixing the errors rather than alienating a large portion of users?

Because it's easier to just blame Microsoft, as the Op has done.

Share this post


Link to post
Share on other sites
  • 0
CPressland    176

I wouldn't say the code is bad, just the CSS is not optimised for Internet Explorer, EVERY other browser I've tried renders the pages without any issues what so ever!

Because it's easier to just blame Microsoft, as the Op has done.

:)

Share this post


Link to post
Share on other sites
  • 0
Mike    89

I'll ask again, got a link to the site? I bet it won't take long to fix it up.

Share this post


Link to post
Share on other sites
  • 0
CPressland    176

lol, TRUST me, you don't want the link. I'd prefer the site to remain private for now.

Share this post


Link to post
Share on other sites
  • 0
DrewJW    9

IE6 is a valid browser? as in how?

Seriously who uses IE6? I won't even let my father used Internet Explorer online.

Share this post


Link to post
Share on other sites
  • 0
CPressland    176
IE6 is a valid browser? as in how?

Seriously who uses IE6? I won't even let my father used Internet Explorer online.

Thankyou :)

More people need to be this way inclined :)

Share this post


Link to post
Share on other sites
  • 0
Numpad    0

Alot of people still use IE6.

And, as for losing over 20% of traffic, is it worth it?

Surely it wont take long to come up with a fix.

Share this post


Link to post
Share on other sites
  • 0
Mathachew    149

You know you can use IE conditionals so that you provide a completely different stylesheet for any version of IE to fix whatever issues you are having. Heck, even if you deemed it necessary, you could have separate stylesheets for IE6, IE7 and IE8. In most cases the fixes for IE aren't that problematic. The most frustrating one I've come across is the PNG hack because I had several instances where it simply wouldn't work. All other issues were padding, margin or alignment issues, which are mostly easy to fix.

Share this post


Link to post
Share on other sites
  • 0
Rohdekill    775
How about actually fixing the errors rather than alienating a large portion of users?

+1

Share this post


Link to post
Share on other sites
  • 0
Mike    89
lol, TRUST me, you don't want the link. I'd prefer the site to remain private for now.

Feel free to send me a PM then, blocking ~20% of your visitors is never a valid thing to do.

Share this post


Link to post
Share on other sites
  • 0
CPressland    176
Alot of people still use IE6.

And, as for losing over 20% of traffic, is it worth it?

Surely it wont take long to come up with a fix.

LMFAO! Numpad, you're a member of the damned site and a Firefox user!

20% is totally worth it when it's non-profit! LMFAO

Share this post


Link to post
Share on other sites
  • 0
CPressland    176

Well guys, we're on two pages now without any luck, does anyone know how I can do this?

I was thinking maybe something as simple as

<!--[if IE 6]>
<meta HTTP-EQUIV="REFRESH" content="0; url=ieblocked.html">
<![endif]-->

But I actually have no idea if that'd work.

What does everyone think?

Share this post


Link to post
Share on other sites
  • 0
Inklin    28

Hey Vegetunks

i just took some looking round and come up with this

<!--[if lt IE 7]>

<script type="text/javascript">

<!--

window.location = "URL TO REDIRECT TO"

//-->

</script>

<![endif]-->

Hope it works :)

Edit: Tried this on my site and it works very well, this will redirect all IE browsers older than IE7, if you want to allow IE8 change

<!--[if lt IE 7]> to

<!--[if lt IE 8]>

as IE8 is a lot better me thinks

Edited by iAwesomeness

Share this post


Link to post
Share on other sites
  • 0
CPressland    176

Solved:

&lt;!--[if IE 6]&gt;
&lt;meta HTTP-EQUIV="REFRESH" content="0; url=ieblocked.html"&gt;
&lt;![endif]--&gt;

&lt;!--[if IE 7]&gt;
&lt;meta HTTP-EQUIV="REFRESH" content="0; url=ieblocked.html"&gt;
&lt;![endif]--&gt;

Amazingly simple... why didn't a genius like me think of that from the get go! haha

Share this post


Link to post
Share on other sites
  • 0
Mathachew    149

If that's what you really want to do, here's a "more optimized" solution:

&lt;!--[if lte IE 7]&gt;
&lt;meta HTTP-EQUIV="REFRESH" content="0; url=ieblocked.html"&gt;
&lt;![endif]--&gt;

Share this post


Link to post
Share on other sites
  • 0
Mike    89
Solved:

&lt;!--[if IE 6]&gt;
&lt;meta HTTP-EQUIV="REFRESH" content="0; url=ieblocked.html"&gt;
&lt;![endif]--&gt;

&lt;!--[if IE 7]&gt;
&lt;meta HTTP-EQUIV="REFRESH" content="0; url=ieblocked.html"&gt;
&lt;![endif]--&gt;

Amazingly simple... why didn't a genius like me think of that from the get go! haha

I'd hardly call you a genius if you can't code a site to work in IE6/7

Share this post


Link to post
Share on other sites
  • 0
CPressland    176
If that's what you really want to do, here's a "more optimized" solution:

&lt;!--[if lte IE 7]&gt;
&lt;meta HTTP-EQUIV="REFRESH" content="0; url=ieblocked.html"&gt;
&lt;![endif]--&gt;

lte? what does that tag do?

I'd hardly call you a genius if you can't code a site to work in IE6/7

lmao, PHPBB3 is hardly a well coded system from the get go, not my fault Microsoft don't have a damned clue what they're doing with page rendering.

But, here is a medal for effort ;) *hands Mike a medal*

Share this post


Link to post
Share on other sites
  • 0
CPressland    176

Nice one, thankyou very much :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.