WebView
A WebView
is a control that shows Web content with a built-in scroller. Declare a WebView like so:
{kind: "WebView"}
The URL to load may be specified when declaring the instance, or by calling the setUrl
method.
{kind: "WebView", url: "http://www.google.com"} goToUrl: function(inUrl) { this.$.webView.setUrl(inUrl); }
Published Properties
Name | Default | Description |
---|---|---|
identifier | "" | Page identifier, used to open new WebView instances for new requests |
url | "" | URL for page, updates as user navigates. Relative URLs are not allowed. |
minFontSize | 16 | Smallest font size shown on the page. Used to stop text from becoming unreadable. |
enableJavascript | true |
Boolean. If true , allows page to run JavaScript.
|
blockPopups | true |
Boolean. If false , allows page to request that new windows be opened.
|
acceptCookies | true |
Boolean. If true , allows WebView to accept cookies from server.
|
redirects | [] |
Array of URL redirections, specified as {regexp: string, cookie: string, enable: boolean}
|
networkInterface | "" | The network interface |
ignoreMetaTags | false |
Boolean. If true , page ignores viewport-related meta tags.
|
cacheAdapter | true |
Boolean. If true , WebKit will cache the plugin when the node is hidden. If your app explicitly destroys the plugin outside the app lifecycle, you must set this to false .
|
Published Events
The WebView
kind publishes the following events:
- onAlertDialog
- onConfirmDialog
- onDisconnected
- onEditorFocusChanged
- onError
- onFileLoad
- onLoadComplete
- onLoadProgress
- onLoadStarted
- onLoadStopped
- onMousehold
- onNewPage
- onPageTitleChanged
- onPrint
- onPromptDialog
- onResized
- onSingleTap
- onSSLConfirmDialog
- onUrlRedirected
- onUserPasswordDialog
Methods
acceptDialog()
Accepts the current dialog.
cancelDialog()
Cancels the current dialog.
clearCache()
Clears the browser cache.
clearCookies()
Clears cookies.
clearHistory()
Clears browser history.
deleteImage(inPath)
Deletes an image from the file system.
disconnect()
Disconnects this WebView from the browser server.
generateIconFromFile(inPath, inIconPath, inLeft, inTop, inWidth, inHeight)
Generates an icon from an image in the file system. Only works with PNG files.
goBack()
Goes back one entry in history.
goForward()
Goes forward one entry in history.
insertStringAtCursor(inString)
If in an editable field, inserts a string at the current cursor position.
printFrame(inName, inJobId, inWidth, inHeight, inDpi, inLandscape, inReverseOrder)
Shows the print dialog to print the current page.
reloadPage()
Reloads the current page.
resizeImage(inFromPath, inToPath, inWidth, inHeight)
Resizes an image in the file system.
saveImageAtPoint(inLeft, inTop, inDirectory, inCallback)
Saves to the file system the image at the specified position.
sendDialogResponse(inResponse)
Responds to the current dialog.
stopLoad()
Stops loading the current page.