Get absolute URL using Javascript

Below is the simple method to get absolute URL using javascript. This code can be run on the Browser Console directly. Open the developer tools and navigate to console tab and paste the below function to test the snippet.

Sample Code Get Absolute URL using Javascript

How to read the current URI in parts?

Let us take an example of the current URL http://code.askmein.com/get-absolute-u…ing-javascript/ ‎

To get the complete URL, we can concat the above code as shown below.

You may also like...

1 Response

  1. Ahmad Maleki says:

    Absolutely Useful! Thank you very much.

Leave a Reply

Your email address will not be published. Required fields are marked *