Skip to content

Show WebView ​

Pop up a WebView in the current app to open the specified URL.

Interface Description ​

Interface Type ​

execShortcut

Parameters ​

ParameterTypeRequiredDescription
deviceIdstring✅Device ID
directivestring✅Fixed value 'showWebview'
payloadstring✅URL address to open

Return Value ​

javascript
true  // Returns true on successful opening

Basic Usage ​

javascript
// Open webpage in WebView
await apiInvoke('execShortcut', {
    deviceId: 'P72578581E07',
    directive: 'showWebview',
    payload: 'https://www.baidu.com'
});

Difference from openUrl ​

FeatureopenUrlshowWebview
Opening MethodOpen in SafariPop up WebView in app
App SwitchingSwitches to SafariStays in current app

Tips

  • Opening an unauthorized URL for the first time will trigger a permission request, which developers need to handle themselves

Cooperation: try.catch@foxmail.com