05/15/2024 15:19:45

Problem description

How to distinguish the embedded webview and the built-in webview?

Causes of the problem

Consulting

Solution

  1. Distinguish them by the interface:
    (1) Is isEmbedWebView:true passed into the extraJson field when V5 invokes the openUrl interface? Does V3 invoke the WGOpenEmbeddedWebView interface to open the web page.
    Demo code for V5:
    string extraJson = "{\"isEmbedWebView\":true}";
    mTestModuleWebView.OpenUrl("http://www.qq.com", "1", "false", "true", extraJson, "false");
    
    Demo code for V3:
    WGPlatform::GetInstance()->WGOpenEmbeddedWebView((char*)"www.qq.com");
    
    (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.
    <input class="btn" type="button" onclick="msdkCall(EmbedWebViewBack)" value="Embed WebView: Back" />
    <input class="btn" type="button" onclick="msdkCall(EmbedWebViewForward)" value="Embed WebView:Forward" />
    
  2. 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 © 2024 MSDK.
All rights reserved.

results matching ""

    No results matching ""