Event listener that will prevent the back button when disableBackButton is enabled
Search for a file or files on the local user machine. Their contents will be loaded into the browser memory and can be used locally without needing to update them to a remote server.
It is mandayory for security reasons that an event from an actual input type='file' element is passed to this method.
We can set here for example the change event that is fired by the input when the user selects a file.
Example for single file: <input type='file' accept=".txt" (change)="onFileSelected($event)"> (call browseLocalFiles() inside the change event handler)
Example for multi files: <input type='file' multiple="multiple" accept=".txt" (change)="onFileSelected($event)">
of the onFileSelected method.
Specify if the files must be loaded as plain "TEXT" or "BASE64" encoded binary data
Once the files selected by the user are correctly loaded into the browser, this callback method will be called with two parameters containing the name and contents for each one of the loaded files.
Void. (An exception will be thrown if the load fails)
Copies the specified text to the clipboard
Some string that will be placed on the system clipboard
Promise A promise to be resolved once the copy is performed
Deletes the specified cookie from browser. Note that the cookie will only be deleted if belongs to the same path as specified.
The name of the cookie we want to delete
Define the path where the cookie is set. By default it is the whole domain: '/'. If the cookie is not set on this path, we must pass the right one or the delete will fail.
True if cookie was deleted or false if cookie could not be deleted or was not found.
TODO
Disable the hability for the user to navigate back on browser history. This method does not disable the browser back button, but it prevents it from leaving the current page.
void
Totally disables the current page scrolling. Useful when creating popups or elements that have an internal scroll,
and we don't want it to interfere with the main document scroll.
Can be enabled again with enableScroll.
void
Restore the back button normal behaviour which was blocked by calling disableBackButton()
void
Restores main document scrolling if has been disabled with HtmlUtils.disableScroll
void
Get the value for an existing cookie.
Adapted from the jquery.cookie plugin by Klaus Hartl: https://github.com/carhartl/jquery-cookie
the name of the cookie we want to get
Cookie value or null if cookie does not exist
Get the current page full url, including 'https://', domain and any uri get parameters
A well formed url
Obtain the value that is found at the current URL hash fragment part. For example: https://someurl.com/home#somehash
Will return 'somehash'
The value of the URL hash fragment but without the # character
TODO
Obtain the current html document height in pixels
Numeric value representing the document height in pixels
Obtain the current html document width in pixels
Numeric value representing the document width in pixels
Tries to detect the language that is set as preferred by the user on the current browser. NOTE: Getting browser language is not accurate. It is always better to use server side language detection
A two digits string containing the detected browser language. For example 'es', 'en', ...
Gives the current position for the browser scroll
Array with the current x,y position based on the top left corner of the current document
Obtain the current viewport browser window height value
A numeric value representing the window height in pixels
Obtain the current viewport browser window width value
A numeric value representing the window width in pixels
Opens the specified url on the browser's current tab or in a new one.
The url that will be loaded
Setting it to true will open the url on a new browser tab. False by default
If we want to send POST data to the url, we can set this parameter to an object where each property will be translated to a POST variable name, and each property value to the POST variable value
void
Check if the specified cookie exists
the name for the cookie we want to find
True if cookie with specified name exists, false otherwise
Check if the currently active URL at the browser contains a hash fragment. The fragment is a part of the URL that comes after the # symbol, and can be modified without needing to reload the page. It is important to know that the url fragment is always available at the browser level and will never be sent to server.
An example of a hash: https://someurl.com/home#somehash
True if the active URL has a hash fragment, false otherwise.
TODO
Tells if the current html document is fully loaded or not.
True if the current html document is fully loaded (including all frames, objects and images) or false otherwise.
Reloads the current url. This will make the browser load all the current html document again and all page state will be lost.
void
Moves the browser scroll to the specified X,Y axis position or DOM element.
The location where the scroll must be moved to. It can be an HTML element instance or an array of two numbers with the [x,y] destination coordinates
The animation duration in miliseconds. Set it to 0 to perform a direct scroll change.
A method that will be executed right after the scroll finishes
void
Set the value for a cookie or create it if not exist
Adapted from the jquery.cookie plugin by Klaus Hartl: https://github.com/carhartl/jquery-cookie
the name for the cookie we want to create
the value we want to set to the new cookie.
The lifetime of the cookie. Value can be a Number
which will be interpreted as days from time of creation or a Date
object. If omitted or '' string, the cookie becomes a session cookie.
Define the path where the cookie is valid. By default it is the whole domain: '/'. A specific path can be passed (/ca/Home/) or a '' string to set it as the current site http path.
Define the domain where the cookie is valid. Default: domain of page where the cookie was created.
If true, the cookie transmission requires a secure protocol (https). Default: false.
True if cookie was created, false otherwise. An exception may be thrown if invalid parameters are specified
TODO
Generated using TypeDoc
An abstraction of the browser entity an all its related operations and properties Browser entity is normally available only on client side or front end view applications, but some of its features can also make sense on a server side app. So depending on the implementation language, this class may or may not have some of its methods implemented.