Skip to main content

Open webpage (OpenUrl)

AndroidiOSPC

If you are using Unreal Engine, please refer to OpenUrl in the Unreal Engine SDK.

note

Starting from iOS 18, iOS devices no longer support using UIApplication's openURL(_:) method.
SDK V1.26.00 and later versions use open(_:options:completionHandler:) instead, so they are not affected.

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​

ParametersTypeExplanation
urlstringWeb page address; all Chinese characters in the URL must be URL encoded
screenOrientationINTLWebViewOrientationAuto = 1
Portrait = 2
Landscape = 3
fullScreenEnableboolWhether the webpage is opened in full screen
Default: false
encryptEnableboolAdd login session data to the link. When encryptEnable is true and in a login session, the specified URL will be encrypted.
Default: true
systemBrowserEnableboolWhether to open using the system browser
Default: false
extraJsonstringJSON format Extended Field
Default is empty

Event Page Parameters​

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

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

note

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

NameTypeExplanationNote
widthintWindows WebView width
Unit: %
Windows only
heightintWindows WebView height
Unit: %
Windows only
BG_COLORstringSet the 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_DISABLEboolWhether the back button is disabled
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 handling interface is WebViewResultObserver.The callback data structure is WebviewResult.

The callback ID is INTL_WEBVIEW_CLOSE_URL.

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

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