Open webpage (OpenUrl)
从 iOS 18 起,iOS 设备不再支持使用 UIApplication 的 openURL(_:) 方法。
SDK V1.26.00 及以上版本已使用 open(_:options:completionHandler:) 方法进行替换,因此不受影响。
For SDK V1.26.00 and earlier versions, INTLWebView cannot navigate to Safari browser, and in-game WebView H5 activities cannot be opened in Safari.
It is recommended for affected businesses to upgrade the SDK version to V1.26.00 or later.
Opening a webpage mainly involves using the WebView module to open a specified web page and controlling the WebView display according to different parameters.
Function Definition
public static void OpenUrl(string url, INTLWebViewOrientation screenOrientation = INTLWebViewOrientation.Auto, bool fullScreenEnable = false,
bool encryptEnable = true, bool systemBrowserEnable = false, string extraJson = "{}")
Parameter Details
| Parameter | Type | Explanation |
|---|---|---|
| url | string | Web page address; all Chinese characters in the URL must be URL encoded |
| screenOrientation | INTLWebViewOrientation | Auto = 1 Portrait = 2 Landscape = 3 |
| fullScreenEnable | bool | Whether the webpage is opened in full screen Default: false |
| encryptEnable | bool | Add login session data to the link. When encryptEnable is true and in a login session, the specified URL will be encrypted.Default: true |
| systemBrowserEnable | bool | Whether to open using the system browser Default: false |
| extraJson | String | JSON format Extended Field Default is empty |
Event Page Parameters
| Name | Description |
|---|---|
| role_id | Role ID |
| role_name | Role name URL-encoded |
| area_id | Region ID |
| zone_id | Zone ID |
| lang_type | Language type (RFC 4646) For example, "en". For details, see Language Type Definition. |
OpenUrl Extended Field Configuration (XSX, PS5 platforms are not supported)
Android has been modified to node display and does not require additional configuration.
| Name | typology | Explanation | Notes |
|---|---|---|---|
| width | int | Windows WebView width Unit: % | Windows only |
| height | int | Windows WebView height Unit: % | Windows only |
| BG_COLOR | string | Set the WebView background color For example: ff0000 | iOS, Android only |
| PROGRESS_TYPE | int | Set progress bar style 0: Progress bar + loading image 1: Progress bar 2: loading image | iOS, Android only |
| isSameProcessWebView | bool | Whether to start the WebView in the same process Default: false | Android only |
| CONFIG_KEY_BACK_DISABLE | bool | Whether the back button is disabled Default: Configuration in INTLConfig.ini | Windows only |
| notch_full_screen | int | Whether to fill the iPhone notch screen 0: Do not fill 1: Fill Default: 0 | iOS only |
| visibleShareMore | bool | Whether the share button is visible Default: true, visible | iOS, Android only |
Callback Processing
The callback handling interface is WebViewResultObserver.The callback data structure is WebviewResult.
The callback ID is INTL_WEBVIEW_CLOSE_URL.
Code Example
If the URL passed cannot be opened, please check if the passed URL is correct.
Example:
- Parameters must have no spaces
- URLs containing Chinese must be url encoded
//Open URL with default effect
INTLAPI.OpenUrl ("https://www.qq.com");
//Open URL, Player Network SDK automatically carries login data
INTLAPI.OpenUrl ("https://www.qq.com", INTLWebViewOrientation.Auto, false, true);
//Open event URL with default effect
INTLAPI.OpenUrl ("https://www.qq.com?role_id=1&role_name=aaa&area_id=1&zone_id=1&lang_type=en");
//Open URL and adjust Windows WebView width and height
INTLAPI.OpenUrl ("https://www.qq.com", INTLWebViewOrientation.Auto, false, true, false, "{\"height\": 60, \"width\": 80}");
Adding login data to links
When the OpenUrl interface is called to open a link, if already logged in, encryption information with login status is automatically included (encryptEnable=true).
However, when using a browser to open the link, to prevent information leakage, login status and other parameters in the link will be removed.
INTLAPI.OpenUrl ("https://www.qq.com", INTLWebViewOrientation.Auto, false, true);
- If not logged in, when
encryptEnable = trueis used to callOpenUrl, the opened link is:
https://www.qq.com
- If logged in, when
encryptEnable = trueis used to callOpenUrl, the opened link is:
https://www.qq.com?gameid=11&channelid=3&os=1&ts=1634707615&sdk_version=1.11.00.487&seq=11-3b61c8315b91d319eaa5622d72c474ec7ee395cee116d142a74b3455607e3d21-1634707615-14&encodeparam=C524E9DE27EB02E552CFBA9C54BFA301317DF66F49C5C02ED708D582B80A1B74DE8F0723731F0D66EBD12095E244097DC3AFAE1203A8FCD2A2821C1DEC9CD3AE254BAD99C93B095E8F39FCE414FBFB0A79F9EA8DF2E1B309190E5A8721A5AC8132E8E89506CDBA1ACBB1C17AA794A658502C5CCA6B25E6105049EABB44C408700FE2713FDD327217AF45A226F46FFD02
URL Parameters
| Parameter | Description |
|---|---|
| gameid | ID assigned to the game |
| channelid | Login channel ID |
| os | Terminal operating system identifier 1: Android 2: iOS 3: Web 4: Linux 5: Windows 6: Nintendo 7: Mac 8: PlayStation 9: Xbox 11: Xbox Series X|S (XSX) 12: WinGDK |
| ts | Timestamp |
| sdk_version | Player Network SDK version |
| seq | Serial number |
| encodeparam | The encrypted fields for account OpenID and token can be obtained through the GetEncodeUrl interface. The corresponding parameters can be parsed via the Player Network SDK backend decryption and verification interface. |
Open Event Page
For the event page to get in-game parameter information, the game must include Event Page Parameters in the URL when opening in-game events through WebView.