Get the page URL for button using window.location.href - Javascript Browser Object Model

Javascript examples for Browser Object Model:Location

Description

Get the page URL for button using window.location.href

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
 </head> /* w  w  w  .j  ava2  s  .  com*/
 <body> 
  <button onclick="document.write(window.location.href)">Button</button>  
 </body>
</html>

Related Tutorials