Welcome Here And Thanks For Visiting. Like Us On Facebook...

EXEIdeas – Let's Your Mind Rock » HTML-CSS-PHP-JavaScript / JavaScript Codes » Get Variable From URL And Use That In Web Page

Get Variable From URL And Use That In Web Page

Do you want to make dynamic webpage using java script then you can go with parameterized URL that will change everything in your page on runtime and that depend upon you. So you can go with this trick to make pages in one page.

What Are URL Variables?

Url variables allow developers to pass multiple values from one page to another in order to display different results every time the same page is loaded. This saves the developer from having to make hundreds of pages which are exactly the same. This is mainly because doing so wouldn’t be very realistic or good for any budget.

So the upper URL is parameterized with variable id and its value is netzspot. You can change variable but have to edit JavaScript.


1.) Pure JavaScript Added.
2.) No JQuery File.
3.) You Can Garb Variables From URLs.
4.) Simple And Fast Loading Code.
5.) Can Work With Any Browser.

How To Add In A WebPage?

1.) Just Go To Your “Web Page File”.
2.) Now “Copy” The Below Codes And “Paste” It To There Positions.
3.) “Save” It, Now You Are Done.

<script type='text/javascript'>
function getUrlVars() {
var vars = {};
var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
vars[key] = value;
return vars;
var theme = getUrlVars()["id"];
document.write('<object id="demoframe" data="http://'+theme+'" type="text/html" ></object>');


1.) Edit Your JavaScript As Per Your Requirements. Rest JavaScript Is Ok For General Us. If You Are Pro, Then You Can Do Any Thing.

Last Words:

That’s all we have. If you have any problem with this code in your template then feel free to contact us with full explanation of your problem. We will reply you as time allow to us. Don’t forget to share this with your friends so they can also take benefit from it and leave your precious feedback in our comment form below. Happy blogging, See you in next article…

You Like It, Please Share This Recipe With Your Friends Using...

6 Responses to “Get Variable From URL And Use That In Web Page”

  1. Sofia says:

    Fanstestic Tutorial Admin, It is very Helpful for using JavaScript.

  2. Thanks for publishing such a informative tutorial it help a lot in my future projects.

  3. Myakion says:

    people do not share their knowledge regarding JavaScript. thanks to share all of this information with us.

Leave a Reply

Your email address will not be published. Required fields are marked *