Piotr Ciszewski
Piotr Ciszewski

Reputation: 1801

meta refresh when using Internet Explorer

I am using some scripts which are not compatible with IE. I would like to apply this line if it's IE:

        <meta http-equiv="Refresh" content="0; url=bio.html">

But if it's not IE, I would like to use this one:

        <meta http-equiv="Refresh" content="5; url=bio.html">

So the timing is different. This doesn't seem to be working for me:

<!--[if IE]
    <meta http-equiv="Refresh" content="0; url=bio.html">
<![endif]-->

<!--[if !IE]
    <meta http-equiv="Refresh" content="5; url=bio.html">
<![endif]-->

Is there any simple way of doing this? so skip to the next page if IE and wait 5 seconds if not IE. TY.

Upvotes: 0

Views: 6738

Answers (2)

EricLaw
EricLaw

Reputation: 57115

For performance reasons, you should not use META Refresh to redirect. Either send a HTTP/3xx redirection from the server, or use clientside JavaScript if you must (using META REFRESH only within a NOSCRIPT block as a fallback).

This article explains the performance cost of using META REFRESH:

http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/meta-refresh-causes-additional-http-requests.aspx

Upvotes: 1

Piotr Ciszewski
Piotr Ciszewski

Reputation: 1801

I have found the way arround. Using PHP it's possible to redirect the page to another one if IE and different one if !IE. So I made a sort of pre-page which is working fine now.

<?
if ( preg_match("/MSIE/",$_SERVER['HTTP_USER_AGENT']) )
    header("Location: bio.html");
else
    header("Location: animation.html");
exit;
?>

and then I can set up a normal timing by html or javascript on the animation.html page:

<script type="text/JavaScript">
<!--
setTimeout("location.href = 'bio.html';",5000);
-->
</script>

Maybe this answer will help someone in future.

Upvotes: 0

Related Questions