namespace
SAPO.Utility.Url
Version:
1.1
utilities to manipulate Url's
requires SAPO.Utility.String
Function Summary
Decode a BASE 64 encoded string
Convert a string to BASE 64
Get last loaded script element
Should be called when the script file is loaded
generates an uri with query string based on the parameters object given
Get anchor string of current or passed URL
Get query string of current or passed URL
Function Details
function base64Decode
Decode a BASE 64 encoded string
Parameters:
string
base64 encoded string
Returns:
string decoded
function base64Encode
Convert a string to BASE 64
Parameters:
string
- string to convert
Returns:
base64 encoded string
function currentScriptElement
Object
currentScriptElement(String
string)
Get last loaded script element
Should be called when the script file is loaded
Parameters:
string
- string to use to match script source
Returns:
Script Element
function genQueryString
generates an uri with query string based on the parameters object given
Parameters:
uri
params
function getAnchor
Get URL anchor
Parameters:
[string]
URL string
Returns:
URL anchor
function getAnchorString
Object
getAnchorString([String
string])
Get anchor string of current or passed URL
Parameters:
[string]
- URL string
Returns:
Object with pairs variable => value of each URL variables
function getQueryString
Object
getQueryString([String
string])
Get query string of current or passed URL
Parameters:
[string]
- URL string
Returns:
Object with pairs variable => value of each URL variables
function getUrl
String
getUrl()
Get current URL of page
Returns:
current URL
function parseUrl
Object
parseUrl(String
string)
Parse passed URL
Example for URL: http://www.sapo.pt/index.html?var1=value1#anchor
Object = {
'scheme' => 'http',
'host' => 'www.sapo.pt',
'path' => '/index.html',
'query' => 'var1&value1',
'fragment' => 'anchor'
}
Parameters:
string
URL string
Returns:
an object with URL structure