Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What is navigator.userAgent.indexof

Status
Not open for further replies.
Jun 3, 2007
84
US
Hello I am completely new to Javascript and wondering if someone could shed some light in regards to the navigator.userAgent.indexof function.

Not quite sure that navigator.UserAgent.indexOf('WINXP')==-1 means.

What does the ==-1 mean does that make it true or false?
 
Usually "indexOf" refers to a method on a collection (dictionary, hash-table, whatever). "-1" would be the returned value when the collection does not include (in this case) 'WINXP'.

_________________
Bob Rashkin
 
Hi

learingperl01 said:
Not quite sure that navigator.UserAgent.indexOf('WINXP')==-1 means.
Code:
navigator.        [gray]// navigator object's[/gray]
UserAgent.        [gray]// userAgent property[/gray]
indexOf('WINXP')  [gray]// contains the string 'WINXP' starting at position[/gray]
==                [gray]// equal with[/gray]
-1                [gray]// minus one[/gray]
In other words it does not contain the give substring. ( If contained a position number starting from 0 would be returned. )

Read some related quick references : [tt]Navigator[/tt], [tt]userAgent[/tt], [tt]indexOf()[/tt], [tt]==[/tt].

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top