Type function Library native.* Return value none Revision Release 2022.3683 Keywords native, showPopup, safari, safariView, webView
Displays the Safari View popup which corresponds to the SFSafariViewController
, introduced in
http://
or https://
.native.showPopup( name, options )
String. The string name of the popup to be shown. For the Safari View plugin, use "safariView"
.
Table. A table that specifies the optional properties for the popup — see the next section for details.
String. URL of the web page. This must start with http://
or https://
.
Boolean. If true
, the controller slides in; otherwise it appears instantly.
Boolean. If true
, Reader mode will be entered automatically when it is available for the web page.
Listener. Listener which supports basic popup events. For the event, event.action
(string) may be one of the following:
"loaded"
— Initial loading is finished."failed"
— Indicates there was an error while loading the URL; the Safari View remains open."done"
— Indicates that the user pressed the "Done" button and the Safari View was closed.local function safariListener( event ) if ( event.action == "failed" ) then print( "Error loading the URL" ) elseif ( event.action == "loaded" ) then print( "Page loaded!" ) elseif ( event.action == "done" ) then print( "Safari view closed" ) end end local popupOptions = { url = "https://coronalabs.com", animated = true, entersReaderIfAvailable = true, listener = safariListener } -- Check if the Safari View is available local safariViewAvailable = native.canShowPopup( "safariView" ) if safariViewAvailable then -- Show the Safari View native.showPopup( "safariView", popupOptions ) end