Possible Duplicate:
Get query string values in JavaScript
I am working on a extension for Chrome. I already figured out how to get the URL from the actual Chrome-Tab.
chrome.tabs.getSelected(null, function(tab) {
document.getElementById('currentLink').innerHTML = tab.url;
});
But now i need to know how to get a specific Parameter from the URL. I already tried out different Javascript-Functions but when i implement them, my Extension stops working.
So: How can i get a specific parameter from the actual URL?
Created simple function to get URL parameter in Javascript from a URL like this
.....58e/web/viewer.html?page=17&getinfo=33
OUTPUT : 18
To get a query string in a single regexp, use:
Then, use the following function to get the value of a specific key:
Not exactly a regex, but this should work:
This should work in most cases. I'll try to dig up the regex I had written for this some time ago.