01/10/2025 10:53:00
Problem description
How to distinguish the embedded webview and the built-in webview?
Causes of the problem
Consulting
Solution
- Distinguish them by the interface:
(1) IsisEmbedWebView:true
passed into theextraJson
field when V5 invokes the openUrl interface? Does V3 invoke the WGOpenEmbeddedWebView interface to open the web page.
Demo code for V5:
Demo code for V3:string extraJson = "{\"isEmbedWebView\":true}"; mTestModuleWebView.OpenUrl("http://www.qq.com", "1", "false", "true", extraJson, "false");
(2) The JS interface of V3 is only applicable to the built-in WebView and is invalid to the embedded WebView. The embedded WebView of V5 supports back and forward functions.WGPlatform::GetInstance()->WGOpenEmbeddedWebView((char*)"www.qq.com");
<input class="btn" type="button" onclick="msdkCall(EmbedWebViewBack)" value="Embed WebView: Back" /> <input class="btn" type="button" onclick="msdkCall(EmbedWebViewForward)" value="Embed WebView:Forward" />
- Distinguish them by whether to open a new process: the built-in WebView will open a new process when opening a web page. The embedded WebView opens a web page without opening a new process, that is, the opening page is in the same Activity as the current page is, and it only supports Android.
Copyright © 2025 MSDK.
All rights reserved.
All rights reserved.