Skip to main content

OpenUrl

AndroidiOSWindowsPS5XSX
If you were looking for the method for use with Unity, see OpenUrl for Unity SDK.

This API is used to open a specified webpage through the WebView module and control the WebView display based on 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 = "{}");

Input parameters

ParameterTypeDescription
UrlFStringWebpage address
URLs with Chinese characters must use url encode
ScreenOrientationUINTLWebViewOrientationAuto=1
Portrait=2
Landscape=3s
It's NOT supported in XSX and PS5
FullScreenEnableboolWhether to open in full screen mode
Default: falses
It's NOT supported in XSX and PS5
EncryptEnableboolAdds login state data to link
Default: true
When EncryptEnable is true and user is logged in, the specified URL is encrypted
SystemBrowserEnableboolWhether to open with the system browser
Default: falses
It's NOT supported in XSX and PS5
ExtraJsonstringJSON format extended field
Empty by defaults

Event page parameters

NameDescription
role_idRole ID
role_nameURL-encoded role name
area_idGame area ID
zone_idGame zone ID
lang_typeLanguage type (RFC 4646)
For example: "en". For details, see Language Type Definitions.

OpenUrl extended field configuration (Not supported in PS5 and XSX)

note

Android has already been adapted to notched displays by default, and no additional configuration is required.

NameTypeNote
widthintWindows WebView width
Units: %
heightintWindows WebView height
Units: %
BG_COLORstringSets the WebView background color
For example: ff0000.
PROGRESS_TYPEintSets the progress bar type
0: Progress bar + Loading icon
1: Progress bar
2: Loading icon
isSameProcessWebViewboolWhether to start WebView in the same process
Default: false
CONFIG_KEY_BACK_DISABLEboolWhether to disable the back button
Default: INTLConfig.ini configuration
notch_full_screenintWhether the iPhone notch is covered
0: Not covered
1: Covered
Default: 0
visibleShareMoreboolWhether the share button is visible
Default: true, which means visible

Observers

The callback processing interface is WebViewResultObserver.
The callback data structure is WebviewResult.

The callback methodID is kMethodIDWebViewURLClose.

Code sample

note

If the input URL cannot be opened, check that the URL is correct.

For example:

  • Parameters cannot contain spaces
  • For URLs with Chinese characters, users must perform url encode.
//Default effect: OpenUrl
UINTLSDKAPI::OpenUrl("https://www.qq.com");

//OpenUrl and add login state data
UINTLSDKAPI::OpenUrl("https://www.qq.com", UINTLWebViewOrientation::kAuto, false, true);

//Default effect: open event URL
UINTLSDKAPI::OpenUrl ("https://www.qq.com?role_id=1&role_name=aaa&area_id=1&zone_id=1&lang_type=en");

//OpenUrl and adjust Windows WebView width and height
INTLAPI.OpenUrl ("https://www.qq.com", UINTLWebViewOrientation.Auto, false, true, false, "{\"height\": 60, \"width\": 80}");

Add Login State Data to Link

To automatically include parameters such as login state in the URL, set encryptEnable=true when calling OpenUrl after the user logs in.
In order to prevent information leakage, parameters such as the login state will be removed from the URL when being opened from a browser.

UINTLSDKAPI::OpenUrl("https://www.qq.com", UINTLWebViewOrientation::kAuto, false, true);
  • If not logged in and calling OpenUrl with encryptEnable = true, the opened URL is:

     https://www.qq.com
  • If logged in and calling OpenUrl with encryptEnable = true, the opened URL 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

Open event page

To allow the event page to get in-game parameters and information, when the game uses WebView to open in-game events, the URL must include the Event Page Parameters.