https://github.com/thybag/urlparse
A simple JavaScript URL Parsing Utility
https://github.com/thybag/urlparse
Last synced: 12 months ago
JSON representation
A simple JavaScript URL Parsing Utility
- Host: GitHub
- URL: https://github.com/thybag/urlparse
- Owner: thybag
- Created: 2011-07-03T14:29:57.000Z (almost 15 years ago)
- Default Branch: master
- Last Pushed: 2011-10-07T17:29:49.000Z (over 14 years ago)
- Last Synced: 2025-06-09T03:37:41.049Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 92.8 KB
- Stars: 5
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
UrlParse - A simple URL parser for JavaScript
---------------------
UrlParse aims to make extracting the part of a URL your interested in a more straightforward proccess.
To try it out use the demo.htm packaged alongside the urlParse.js code.
**Tested in:**
* Chrome
* Firefox
* IE 9
**Usage Examples:**
//Example 1
var test = urlParse("http://www.sub.domain.com:1337/test/sample.php?queryArg1=Hello&queryArg2=Goodby");
alert(test.getQueryParam('queryArg2')); // "goodbye"
alert(test.getPort()); // "1337"
alert(test.getHost()); // "www.sub.domain.com"
alert(test.getPath()); // "/test/sample.php"
//Example 2
alert(urlParse("http://test.com:17/?a=Cake&b=Cheese").getQueryParam('a')); // "Cake"