Namespace sap.m.URLHelperModule: sap/m/library
URL(Uniform Resource Locator) Helper.
This helper can be used to trigger a native application (e.g. email, sms, phone) from the browser. That means we are restricted of browser or application implementation. e.g.
- Some browsers do not let you to pass more than 2022 characters in the URL
- MAPI (Outlook) limit is 2083, max. path under Internet Explorer it is 2048
- Different Internet Explorer versions have a different limitation (IE9 approximately 1000 characters)
- MS mail app under Windows 8 cuts mail links after approximately 100 characters
- Safari gets a confirmation from user before opening a native application and can block other triggers if the user cancels it
- Some mail applications(Outlook) do not respect all encodings(e.g. Cyrillic texts are not encoded correctly)
Note: all the given limitation lengths are for encoded text(e.g space character will be encoded to "%20").
Since: 1.10.
Method Summary
Method Detail
attachRedirect(fnFunction, oListener?): Object
Adds an event registration for redirect.
Parameters:
{function} | fnFunction | The function to call, when the event occurs. |
{Object} | oListener? | The object, that wants to be notified, when the event occurs. |
Returns:
{Object} | sap.m.URLHelper instance |
detachRedirect(fnFunction, oListener?): Object
Detach already registered redirect event.
Parameters:
{function} | fnFunction | The function to call, when the event occurs. |
{Object} | oListener? | The object, that wants to be notified, when the event occurs. |
Returns:
{Object} | sap.m.URLHelper instance |
normalizeEmail(sEmail?, sSubject?, sBody?, sCC?, sBCC?): String
Builds Email URI from given parameter. Trims spaces from email addresses.
Parameters:
{String} | sEmail? | Destination email address |
{String} | sSubject? | Subject of the email address |
{String} | sBody? | Default message text |
{String} | sCC? | Carbon Copy email address |
{String} | sBCC? | Blind carbon copy email address |
Returns:
{String} | Email URI scheme |
normalizeSms(sTel?): String
Sanitizes the given telephone number and returns SMS URI scheme.
Parameters:
{String} | sTel? | Telephone number |
Returns:
{String} | SMS URI scheme |
normalizeTel(sTel?): String
Sanitizes the given telephone number and returns a telephone URI scheme.
Parameters:
{String} | sTel? | Telephone number |
Returns:
{String} | Telephone URI scheme |
redirect(sURL, bNewWindow?)
Redirects to the given URL. This method fires "redirect" event before opening the URL.
Parameters:
{String} | sURL | Uniform resource locator |
{boolean} | bNewWindow? | Opens URL in a new browser window or tab. Please note that, opening a new window/tab can be ignored by browsers(e.g. on Windows Phone) or by popup blockers. NOTE: On Windows Phone the URL will be enforced to open in the same window if opening in a new window/tab fails (because of a known system restriction on cross-window communications). Use sap.m.Link instead (with blank target) if you necessarily need to open URL in a new window. |
triggerEmail(sEmail?, sSubject?, sBody?, sCC?, sBCC?)
Trigger email application to send email. Trims spaces from email addresses.
Parameters:
{String} | sEmail? | Destination email address |
{String} | sSubject? | Subject of the email address |
{String} | sBody? | Default message text |
{String} | sCC? | Carbon Copy email address |
{String} | sBCC? | Blind carbon copy email address |