You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But the output is always some form of escaped text: "\u003Chead>\u003Cmeta charset=\"UTF-8\">\u003Cmeta content=\"width=device-width,minimum-scale=1.0\" name=\"viewport\">\u003Cmeta content=\"telephone=no\" name=\"format-detection\">\u003Cmeta content=\"address=no\" name=\"format-detection\">\u003Cmeta content=\"origin\" name=\"referrer\">\u003Cmeta content=\"notranslate\" name=\"google\">\u003Clink href=\"/images/branding/product/1x/gsa_android_144dp.png\" rel=\"icon\">\u003Cmeta content=\"/images/branding/googleg/1x/googleg_standard_color_128dp.png\" itemprop=\"image\">
Is this the proper behavior? I can't seem to figure out what type of escape this is. One of the things I was thinking is if there was a way to catch it earlier? I noticed that if I use console.log, it seems to output in the flutter console in proper formatting:
The response is JSON escaped, so if anyone else runs into this problem, just use the built in decode function in the dart-convert package to unescape it.
I'm trying to get the source from a webview, and I'm using evalJavascript to try and get the document's innerHTML:
@override void initState() { flutterWebviewPlugin.onStateChanged.listen((state) async { if (state.type == WebViewState.finishLoad) { String response = await flutterWebviewPlugin.evalJavascript('document.documentElement.innerHTML;'); print(response); } }); }
But the output is always some form of escaped text:
"\u003Chead>\u003Cmeta charset=\"UTF-8\">\u003Cmeta content=\"width=device-width,minimum-scale=1.0\" name=\"viewport\">\u003Cmeta content=\"telephone=no\" name=\"format-detection\">\u003Cmeta content=\"address=no\" name=\"format-detection\">\u003Cmeta content=\"origin\" name=\"referrer\">\u003Cmeta content=\"notranslate\" name=\"google\">\u003Clink href=\"/images/branding/product/1x/gsa_android_144dp.png\" rel=\"icon\">\u003Cmeta content=\"/images/branding/googleg/1x/googleg_standard_color_128dp.png\" itemprop=\"image\">
Is this the proper behavior? I can't seem to figure out what type of escape this is. One of the things I was thinking is if there was a way to catch it earlier? I noticed that if I use console.log, it seems to output in the flutter console in proper formatting:
String response = await flutterWebviewPlugin.evalJavascript('console.log(document.documentElement.innerHTML);');
Which yields something like this:
[INFO:CONSOLE(1)] "<head><meta charset="UTF-8"><meta content="width=device-width,minimum-scale=1.0" name="viewport"><meta content="telephone=no" name="format-detection"><meta content="address=no" name="format-detection"><meta content="origin" name="referrer"><meta content="notranslate" name="google"><link href="/images/branding/product/1x/gsa_android_144dp.png" rel="icon"><meta content="/images/branding/googleg/1x/googleg_standard_color_128dp.png" itemprop="image"><title>Google</title><script nonce="vnS8R6Yzt54tLKduMnYLPg==">
The text was updated successfully, but these errors were encountered: