- Forums
- Javascipt
- Learn How To Get The URL From Address Bar Using Javascript
you will learn to get the URL from the browser using javascript code. these are some notes for getting the URL that appears on a visitors browser address bar [801], Last Updated: Sat May 18, 2024
wallpaperama
Mon May 26, 2008
29 Comments
77449 Visits
document.location.href
today i wanted to get the full url from my browser using javascript
so in order to help others, im posting my notes here so you guys with wallpaper websites can benefit and make your websites much better using php and javascript both server side and clien side scripts
so i lets say i want to get the url from the current page im viewing right now well you can use this code to do that
<script language="javascript" type="text/javascript">
document.write (document.location.href);
</script>
look at the demo below to see how how it works
GET URL DEMO
as you can see, this is an easy way of getting the full url address from the adress bar in your browser like firefox or internet explorer
now the trick is to make this server side like php that would be awsome but i haven't figure out that one out yet.
i hope this helped you.. if so, please give me your comments, if it was a waste of your time,, hmm. still tell me what you think.
thanks