Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to read content of the address bar after '?' sign and insert value to HTML?

I am redirecting from some page to index.html. Page redirect to index by using following address in the address bar: http://localhost/index.html?page.html

How can I read the value after ? sign and insert it (page.html) into index.html file?

like image 821
HelpNeeder Avatar asked Mar 02 '12 00:03

HelpNeeder


People also ask

Which of the following methods is used to read existing URL from the browser's address bar?

href => This will return the entire URL displaying in the address bar.

Which method is used to change the address in address bar of the browser?

HTML5 History API allows browsers to change the URL in browser address bar without reloading or refreshing the page using pushState function. The pushState method works similar to window.

How do I find a URL address?

On your computer, go to google.com. Search for the page. In search results, click the title of the page. At the top of your browser, click the address bar to select the entire URL.

How do I paste HTML code into Chrome?

From the top menu, select Tools > Web Developer > Page Source. A new tab will open with the page's code, which you can copy by highlighting a specific area or by right-clicking to Select All if you want all of the code. Press Ctrl+C or Command+C on your keyboard and paste it into a text or document file.


1 Answers

var url = window.location.href;
var params = url.split('?');

alert(params[1]);
like image 85
Joseph Avatar answered Sep 22 '22 03:09

Joseph