Forum Moderators: open

Message Too Old, No Replies

indexOf("mac")!= -1

browser sniffer

         

webaster

8:20 pm on Mar 24, 2005 (gmt 0)

10+ Year Member



This code

var agt = navigator.userAgent.toLowerCase();
if((agt.indexOf("msie 5")!= -1) && (agt.indexOf("mac")!= -1)){

What does this part do?

indexOf("mac")!= -1

Rambo Tribble

11:25 pm on Mar 24, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This script seems to be designed to specifically identify Microsoft Internet Explorer 5 on the Macintosh platform, since it would be unlikely another browser would have both those character strings as substrings in the value it returned for the userAgent property.