Forum Moderators: open

Message Too Old, No Replies

Need help with simple JS if IE or else...

         

JAB Creations

12:06 am on Jun 7, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm just trying to get this script do basically do...

If UA contains (not is) msie then echo bad else echo good.

<script type="text/javascript">
if(useragent="msie");
{document.writeln('bad')};
else
{document.writeln('good')};
</script>

Once I get this working fine I'll refine it later on and post it should anyone want. I just got a little rusty of late. ;-)

ChadSEO

8:07 pm on Jun 7, 2005 (gmt 0)

10+ Year Member



Try this out:
if(navigator.userAgent.search(/msie/i)!= -1) {
// IE Code
} else {
// Non-IE Code
}