drab v0.4.1 Drab.Browser
Browser related functions.
Provides information about connected browser, such as local datetime, user agent.
Summary
Functions
Sends the log to the browser console for debugging
Broadcasts the log to the browser consoles for debugging/
Returns browser language
Returns a list of browser supported languages
Returns local browser time as NaiveDateTime. Timezone information is not included
Redirects to the given url
Broadcast version of redirect_to
Returns browser information (userAgent)
Returns utc offset (the difference between local browser time and UTC time), in seconds
Functions
Returns a list of browser supported languages.
Example:
iex> Drab.Browser.languages(socket)
["en-US", "en", "pl"]
Returns local browser time as NaiveDateTime. Timezone information is not included.
Examples:
iex> Drab.Browser.now(socket)
~N[2017-04-01 15:07:57.027000]
Redirects to the given url.
WARNING: redirection will disconnect the current websocket, so it should be the last function launched in the handler.
Broadcast version of redirect_to
.
WARNING: redirection will disconnect the current websocket, so it should be the last function launched in the handler.
Returns browser information (userAgent).
Examples:
iex> Drab.Browser.user_agent(socket)
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) ..."