Open URL
Open a specified URL in the iOS device's Safari browser.
Interface Description
Interface Type
execShortcutParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
deviceId | string | ✅ | Device ID |
directive | string | ✅ | Fixed value 'openUrl' |
payload | string | ✅ | 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:
- Cause the app to be in a "defocused" state
- 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