Parse URL In jQuery - ddUrl

File Size: 7.73 KB
Views Total: 693
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
Parse URL In jQuery - ddUrl

ddUrl is a jQuery based URL parser for developers that parses the current page URL or a link you provide and returns its components similar to the PHP's parse_url function.

Return Values:

  • full URL
  • protocol
  • host (domain name)
  • port
  • path
  • relative path
  • hash parameters
  • query parameters
  • isInternal: true

How to use it:

1. Load the ddUrl plugin's script after jQuery and we're ready to go.

<script src="/path/to/jquery.min.js"></script>
<script src="/path/to/jQuery.ddUrl.js"></script>

2. Get full data of your current URL.

=> An object containing all components

3. Get the full URL.


4. Get the protocol from your current URL.

=> https

5. Get the host (domain name) from your current URL.


6. Get the port from your current URL.

=> 8080

7. Get the current/relative path.

=> /path/to/

=> /path/to/

8. Get the query parameters as strings or objects.

=> param1=value1&param2=value2

=> {param1: 'value1', param2: 'value2'}


9. Get the hash parameters as strings or objects.

=> param1=value1&param2=value2

=> {param1: 'value1', param2: 'value2'}


10. Check if the current URL is an internal link.

=> true/false

11. Parse a URL you provide.


12. Parse a query string you provide.


13. Parse a URL path you provide.


This awesome jQuery plugin is developed by DivanDesign. For more Advanced Usages, please check the demo page or visit the official website.