返回当前页面的完整 URL

  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4.  
  5. <h1>window.location 对象</h1>
  6.  
  7. <p id="demo"></p>
  8.  
  9. <script>
  10. document.getElementById("demo").innerHTML =
  11. "本页面的完整 URL 是:<br>" + window.location.href;
  12. </script>
  13.  
  14. </body>
  15. </html>