Reputation: 29497
It's common to use URL parameters to show dynamic information, just like here on StackOverflow:
http://stackoverflow.com/questions/1183842
But would that be possible when you're without any language like PHP or others? Is there any way to get that value using JavaScript and capture it inside a variable to present it like this:
<h1>param_variable</h1>
Upvotes: 1
Views: 8384
Reputation: 103135
In JavaScript you can get the current page's url like this:
var url = location.href;
You may then need to parse it your self to find the parameter that you are looking for.
Upvotes: 0
Reputation: 16553
window.location.href
contains the current URL. With some string manipulations you can grab anything you want from it.
In this case:
var url = window.location.href;
var id = url.split('/')[4];
alert(id);
Will alert
4479268
Upvotes: 5