Open In App
Related Articles

HTML | DOM Location Search Property

Improve Article
Save Article
Like Article

The Location Search property in HTML DOM is used to set or return the query part of URL including question mark. The query part is the part of URL after the question mark. 


  • It returns the location search property.
  • It is used to set the location search property. = searchString

Property Value: searchString which is used to specify the search part of URL. 

Return Value: It returns a string which represents the search value. 

Example: This example display the search part of URL. 


<!DOCTYPE html>
        HTML DOM Location search Property
        HTML DOM Location search Property
    <button onclick="myGeeks()">Click Here!</button>
    <!-- script to return location search property -->
        function myGeeks() {
            const url = document.createElement('a');
            window.alert("URL search value of current page: "



Supported Browsers: The browser supported by DOM Location search Property are listed below:

  • Google Chrome 1
  • Edge 12
  • Internet Explorer 3
  • Firefox 1
  • Opera 12.1
  • Safari 1
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 05 Jul, 2022
Like Article
Save Article
Similar Reads
Complete Tutorials