Page-Details : _GET Web Address Reader | JavaScriptSource

Page-Details : _GET Web Address Reader

Greg Burghardt Mar 2, 2007


This script will allow you to grab variable-value pairs from the URL of a page, much like PHP grabs data from the URL. It places foo=bar data in a JavaScript object called _GET, and can be referenced similar to $_GET in PHP.

Try it out:

  • Enter any variable-value pair in the URL (adding it to the end of the URL),
    e.g., "?my_name=Bob&last_name=Smith" (w/o quotes)

  • or click one of the sample links below:

_GET items found for this URL:


Source Code

Paste this source code into the designated areas.

External file

Paste this code into an external JavaScript file named: getReader.js


Paste this code into the HEAD section of your HTML document.

Leave a Response


You will need to submit your question to the [a href=""]JavaScript Forum[/a] for further help.

Lee Oct 5, 2007

I'm new to javascripting - How do you output this info on the page?

Wendy Oct 4, 2007

This script reads the URL of a web page, and then creates a JavaScript object of all the foo=bar pairs in the URL. For example, if you have somepage.php?section=news&id=25451, the _GET variable in JavaScript would have the following two properties:[p]_GET.section // Is set to "news"[br /] // Is set to "25451"[p]One thing to note, even if you have a number value in the URL, like "25451", JavaScript will treat it like a string, so you'll need to use the parseInt or parseFloat functions to make them true numbers.[p] // Is a string[br /]parseFloat( // Is an floating point number[br /]parseInt( // Is an integer number

Greg Burghardt Apr 11, 2007

I do not understand what this feature does. Thank You

Amjad Talib Mar 2, 2007