SAPO::Utility.Url->parseUrl
This method will return a parsed URL in object format with following keys.
- scheme
- host
- path
- query
- fragment
- port
- user
- pass
This is static method.
Syntax
SAPO.Utility.Url.parseUrl(<string>)
Compatibility
| All browsers | Yes |
Depends
Input Parameters
- <string> Url to be parsed
Sample
http://js.sapo.pt/SAPO/Utility/Url/sample/
Example
alert(SAPO.Utility.Url.parseUrl('http://username:password@www.example.com:80/index.php?var1=value1&var2=value2#urlanchor'));
Will return:
{
scheme: 'http',
host: 'www.example.com',
path: '/index.php',
query: 'var1=value1&var2=value2',
fragment: 'urlanchor',
port: 80,
user: 'username',
pass: 'password'
}
Community feedback