Jump to content

Displaying URL Parameters


wispas

Recommended Posts

There's no native support for this in JavaScript, however it has a property within the window.location object called search. You can use regex to match() and return the needed part of the string:

 

var myParameter = window.location.search.match(/myParameter\=([^&]+)/)[1];

 

If this is something you plan to use multiple times I'd convert it into a function.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.