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
UFUNCTION(BlueprintCallable, Category = "INTLSDKAPI")
static bool OpenUrl(const FString Url, UINTLWebViewOrientation ScreenOrientation = UINTLWebViewOrientation::kAuto, bool FullScreenEnable = false, bool EncryptEnable = true, bool SystemBrowserEnable= false, const FString ExtraJson = "{}");
Parameter Details
| Parameter | Type | Explanation | Remarks |
|---|---|---|---|
| Url | FString | Webpage addressChinese in URL must be url encoded | |
| ScreenOrientation | UINTLWebViewOrientation | Auto = 1 Portrait = 2 Landscape = 3 | This parameter is not supported on XSX, PS5 platforms. |
| FullScreenEnable | bool | Whether the webpage is opened in full screen Default: false | This parameter is not supported on XSX, PS5 platforms. |
| EncryptEnable | bool | Link adds login state data. If EncryptEnable is true and logged in, specified URLs will be encryptedDefault: true | |
| SystemBrowserEnable | bool | Whether to open using the system browser Default: false | This parameter is not supported on XSX, PS5 platforms. |
| 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". See Language Type Definition for details. |
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 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 | Disable back button 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 interface is WebViewResultObserver.The callback data structure is WebviewResult.
The callback ID is kMethodIDWebViewURLClose.
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
UINTLSDKAPI::OpenUrl("https://www.qq.com");
//Open URL, Player Network SDK will automatically carry login state data
UINTLSDKAPI::OpenUrl("https://www.qq.com", UINTLWebViewOrientation::kAuto, false, true);
//Open event URL with default effect
UINTLSDKAPI::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", UINTLWebViewOrientation.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.
UINTLSDKAPI::OpenUrl("https://www.qq.com", UINTLWebViewOrientation::kAuto, false, true);
- If not logged in, when
encryptEnable = trueis used to callOpenUrl, the opened link is:
https://www.qq.com
- If logged in, using
encryptEnable = trueto 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 | 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 OpenID and token encryption fields can be obtained through the GetEncodeUrl interface. The corresponding parameters can be parsed by the backend through the Player Network SDK's Decrypt Validation 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.