The Open Source Swiss Army Knife

/code/javascript/
/code/javascript/ + sub-categories
http://www.sirfsup.com/
web directory content
    
      

Not logged in
Chat Register Login
return to:  http:/www.sirfsup.com      /code   /javascript 
Permalink: newwind.txt
Title: add
article options : please login   |  raw source view  

search

A string beginning with a question mark that specifies any query information in the URL.

Property of

Location
Implemented in

Navigator 2.0

Security

Navigator 3.0: This property is tainted by default. For information on data tainting, see "JavaScript
Security".

Description

The search property specifies a portion of the URL. This property applies to HTTP URLs only.

The search property contains variable and value pairs; each pair is separated by an ampersand.
For example, two pairs in a search string could look as follows:

?x=7&y=5

You can set the search property at any time, although it is safer to set the href property to change
a location. If the search that you specify cannot be found in the current location, you get an error.

See Section 3.3 of RFC 1738
(http://www.cis.ohio-state.edu/htbin/rfc/rfc1738.html) for complete information
about the search.

Examples

In the following example, the window.open statement creates a window called newWindow and
loads the specified URL into it. The document.write statements display properties of
newWindow.location in a window called msgWindow.

newWindow=window.open

("http://guide-p.infoseek.com/WW/NS/Titles?qt=RFC+1738+&col=WW")

msgWindow.document.write("newWindow.location.href = " +

newWindow.location.href + "<P>")
msgWindow.document.close()
msgWindow.document.write("newWindow.location.search = " +

newWindow.location.search + "<P>")
msgWindow.document.close()

The previous example displays the following output:

newWindow.location.href =

http://guide-p.infoseek.com/WW/NS/Titles?qt=RFC+1738+&col=WW
newWindow.location.search = ?qt=RFC+1738+&col=WW


Leave a Reply
Your Name:     anonymous
Your Email:
Website:  
Comments:

The author will be notified of your reply.
return to top