JavaScript document.URL
The property of JavaScript document.URL can help you find out the current URL of the webpage. Document.URL obtains a complete URL, including the domain and URL parameters. If you need to intercept some information, you can use the method introduced in this article : Use JavaScript to get the simple syntax of the current URL and other URL parameters.
JavaScript document.URL example
<script language='javascript'> alert(document.URL); </script>
The alert used in the example means to jump out of the dialog window, and the content that jumps out, we use the syntax of document.URL, let JavaScript to help us grab the current URL, we made a simple HTML button to let you understand the actual Operational results.
Make JavaScript document.URL into a button
<input type="button" value="Display URL" onclick="javascript:alert(document.URL);">
The onclick in the button means that when a user executes the button action, a JavaScript event is triggered to alert and jump out of the room window to tell the user the current URL.
Post a Comment
0 Comments