PDA

View Full Version : Page change when openened in IE


kruimel0
03-08-2009, 12:12 PM
Hello, I have a question:

My site can only be viewed good in FireFox, not in Internet Explorer.
I have found a script now which allows me to, if the page is viewed in FF, it goes to another page, while that same page stays in IE.

This is the script:

<script type="text/javascript">
if (navigator.userAgent.indexOf("MSIE")==-1) window.location="IE.html";
</script>
Between the <head> and </head> tags

However, as said, this will change pages when opened in FireFox. Now i want to change this script so that it only change pages when opened in Internet Explorer.
Can anyone help me with that?

Thanks, Kruimel

coothead
03-08-2009, 02:00 PM
Hi there kruimel0,

and a warm welcome to these forums. :agree:
Using javascipt to swap pages, because of poor coding, is bad practice. :disagree:
This means that you could loose 6-10% of your visitors who have javascript disabled. :eek:
It would be far better to make use of... IE comments (http://www.quirksmode.org/css/condcom.html)... instead. :agree:
If you still wish to take the javascript route, then use this...

<script type="text/javascript">
if( /*@cc_on!@*/false ){
window.location="IE.html";
}
</script>

kruimel0
03-09-2009, 03:23 PM
Hi there kruimel0,

and a warm welcome to these forums. :agree:
Using javascipt to swap pages, because of poor coding, is bad practice. :disagree:
This means that you could loose 6-10% of your visitors who have javascript disabled. :eek:
It would be far better to make use of... IE comments (http://www.quirksmode.org/css/condcom.html)... instead. :agree:
If you still wish to take the javascript route, then use this...

<script type="text/javascript">
if( /*@cc_on!@*/false ){
window.location="IE.html";
}
</script>


Ah, Thanks for your help, it worked great, and I know it would be better to just be able to view it in IE, but I've tried hard enough, so I'll keep this untill I found something else..

Thanks, Kruimel

coothead
03-09-2009, 03:28 PM
No problem, you're very welcome. :agree: