Skip to main content

Open webpage (OpenUrl)

AndroidiOSWindowsPS5XSX
If you are using the Unity engine, see Unity SDK's OpenUrl.
note

从 iOS 18 起,iOS 设备不再支持使用 UIApplicationopenURL(_:) 方法。
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

ParameterTypeExplanationRemarks
UrlFStringWebpage addressChinese in URL must be url encoded
ScreenOrientationUINTLWebViewOrientationAuto = 1
Portrait = 2
Landscape = 3
This parameter is not supported on XSX, PS5 platforms.
FullScreenEnableboolWhether the webpage is opened in full screen
Default: false
This parameter is not supported on XSX, PS5 platforms.
EncryptEnableboolLink adds login state data. If EncryptEnable is true and logged in, specified URLs will be encrypted
Default: true
SystemBrowserEnableboolWhether to open using the system browser
Default: false
This parameter is not supported on XSX, PS5 platforms.
ExtraJsonstringJSON format Extended Field
Default is empty

Event Page Parameters

NameDescription
role_idRole ID
role_nameRole name URL-encoded
area_idRegion ID
zone_idZone ID
lang_typeLanguage type (RFC 4646)
For example, "en". See Language Type Definition for details.

OpenUrl Extended Field Configuration (XSX, PS5 platforms are not supported)

note

Android has been modified to node display and does not require additional configuration.

NametypologyExplanationNotes
widthintWindows WebView width
Unit: %
Windows only
heightintWindows WebView height
Unit: %
Windows only
BG_COLORStringSet WebView background color
For example, ff0000.
iOS, Android only
PROGRESS_TYPEintSet progress bar style
0: Progress bar + loading image
1: Progress bar
2: loading image
iOS, Android only
isSameProcessWebViewboolWhether to start the WebView in the same process
Default: false
Android only
CONFIG_KEY_BACK_DISABLEboolDisable back button
Default: Configuration in INTLConfig.ini
Windows only
notch_full_screenintWhether to fill the iPhone notch screen
0: Do not fill
1: Fill
Default: 0
iOS only
visibleShareMoreboolWhether 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

note

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 = true is used to call OpenUrl, the opened link is:
 https://www.qq.com
  • If logged in, using encryptEnable = true to call OpenUrl, 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

ParameterDescription
gameidID assigned to the game
channelidLogin channel ID
osOperating 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
tsTimestamp
sdk_versionPlayer Network SDK version
seqSerial number
encodeparamThe 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.