Skip to content

Open URL ​

Open a specified URL in the iOS device's Safari browser.

Interface Description ​

Interface Type ​

execShortcut

Parameters ​

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

Return Value ​

javascript
true  // Returns true on successful opening

⚠️ Notice

Avoid using this interface to open apps via scheme URLs unless necessary!

If you use a Scheme URL to open an app, the following issues may rarely occur when running frequently for extended periods:

  1. Cause the app to be in a "defocused" state
  2. Cause Shortcuts to freeze

Recommendation: If you need to open an app, please use the Open App interface.

Basic Usage ​

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

Notes ​

Tips

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

Cooperation: try.catch@foxmail.com