API/libsapojs/SAPO/Utility/Url

[Elements] are optional

Class SAPO.Utility.Url


class SAPO.Utility.Url
utilities to manipulate Url's
Defined in Utility/Url/0.1/lib.js

Function Summary
Decode a BASE 64 encoded string
Convert a string to BASE 64
Object currentScriptElement (String string)
Get last loaded script element Should be called when the script file is loaded
String getAnchor ([String string])
Get URL anchor
Object getAnchorString ([String string])
Get anchor string of current or passed URL
Object getQueryString ([String string])
Get query string of current or passed URL
Get current URL of page
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' }

Function Details

function base64Decode

String base64Decode(String string)
Decode a BASE 64 encoded string
Parameters:
string base64 encoded string
Returns:
string decoded

function base64Encode

String base64Encode(String string)
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 getAnchor

String getAnchor([String string])
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