Latest web development tutorials

Location search property

Location Object Reference Location Object

Definition and Usage

(Part of the question mark? After) search a property is readable and writable string sets or returns the current query portion of the URL.

grammar

location.search


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support attribute search


Examples

Examples

Returns the query part of the URL. Suppose the current URL is http://www.w3big.com/submit.htm?email=someone@ example.com:

<script>

document.write(location.search);

</script>

Examples of the above output:



Location Object Reference Location Object