Safari WebView Plugin
The safari webview plugin allows you to create faster and more feature rich webviews
Platforms:
supports iOS devices running iOS 8 or later.Functions:
safariWebview.newView(x, y, width, height, lis, enablePersistentWebViews(optional boolean))
Creates a new webview, please note width and height are not aligned with coronas width and height, please ajust based on your needs
lis(function)
- event.phase -- string
- "finished"
- "terminate"
- "loading"
- "began"
- event.url --string url of request
- event.title --string page title
- event.isError -- boolean is there was an error
- event.error -- string what the error was
safariWebview.clearCacheAndStorage(lis)
--clear all webview storage and cacheslis(function)
- event.phase -- string
- "completed"
Webview Properties:
x (number) x position(corona point)
y (number) y position(corona point)
rotation (number) rotation of webview
width (number) width of webview
allowsLinkPreview (boolean) A Boolean value that determines whether pressing on a link displays a preview of the destination for the link
allowsBackForwardNavigationGestures (boolean) A Boolean value indicating whether horizontal swipe gestures will trigger back-forward navigations
Webview method:
myWebView:getEstimatedProgress() returns number, An estimate of what fraction of the current navigation has been loaded value between 0-1
myWebView:destory() remove webview
myWebView:getUrl() returns string, returns current url
myWebView:getTitle() returns string, returns current title
myWebView:hasOnlySecureContent() returns boolean, A Boolean value indicating whether all resources on the page have been loaded through securely encrypted connections
myWebView:isLoading() returns boolean, A Boolean value indicating if loading
myWebView:canGoBack() returns boolean, A Boolean value indicating whether there is a back item in the back-forward list that can be navigated to
myWebView:canGoForward() returns boolean, A Boolean value indicating whether there is a forward item in the back-forward list that can be navigated to
myWebView:request(url) url of page for webview
myWebView:goBack() go back to previous webpage
myWebView:goForward() go forward to next webpage
myWebView:reload() reload webpage
myWebView:requestFromFile(path) path to html file via system.pathToFile()
myWebView:requestFromString(html) html (string) code to render on webview
myWebView:stopLoading() stop loading webview
Example: