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
I use the webview_scaffold to open a web.
the webpage contains contains a timer.
this is a html file I have used:
<html>
<head>
<title>Timer</title>
<script>
var s;
function $(id){
return document.getElementById(id);
}
function display(){
var date = new Date();
var str = date.getTime();
$("content").value = str;
console.log("this this a console log..." + str);
s = setTimeout('display()',1000);
}
window.onload = function(){
$("start").onclick =function(){display();}
$("stop").onclick = function(){clearTimeout(s);}
}
</script>
</head>
<body>
<input type = "text" id=content>
<input type = button id=start value="Start">
<input type = button id=stop value="End">
</body>
</html>
It means that change the display num and print some log per second.
this is my webviewPage.dart
//! WebViewPage
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_webview_plugin/flutter_webview_plugin.dart';
class AppWebView extends StatelessWidget {
final String url;
final String title;
AppWebView(this.url, this.title);
_renderTitle() {
if (url == null || url.length == 0) {
return new Text(title);
}
return new Row(children: [
//new Expanded(child: new Container()),
new Text(title)
]);
}
@override
Widget build(BuildContext context) {
return new WebviewScaffold(
withJavascript: true,
hidden: false,
url: url,
scrollBar:false,
withLocalUrl: true,
appBar: new AppBar(
title: _renderTitle(),
),
);
}
}
when I open the webview to the html file,then I press the start button on this web.Finally I exit the webview.
this is my log:
I/flutter ( 4095): 运维页面
I/zygote64( 4095): Compiler allocated 8MB to compile void android.view.ViewRootImpl.performTraversals()
D/ViewRootImpl@d8ee1fe[MainActivity]( 4095): ViewPostIme pointer 0
D/ViewRootImpl@d8ee1fe[MainActivity]( 4095): ViewPostIme pointer 1
I/chromium( 4095): [INFO:CONSOLE(24)] "this this a console log...1545273611702", source: http://192.168.10.104/test.html (24)
V/InputMethodManager( 4095): Starting input: tba=android.view.inputmethod.EditorInfo@560ef34 nm : com.example.dfelectricapp ic=null
I/InputMethodManager( 4095): startInputInner - mService.startInputOrWindowGainedFocus
D/InputMethodManager( 4095): HSIFW - flag : 0 Pid : 4095
I/chromium( 4095): [INFO:CONSOLE(24)] "this this a console log...1545273612709", source: http://192.168.10.104/test.html (24)
I/chromium( 4095): [INFO:CONSOLE(24)] "this this a console log...1545273613719", source: http://192.168.10.104/test.html (24)
I/chromium( 4095): [INFO:CONSOLE(24)] "this this a console log...1545273614726", source: http://192.168.10.104/test.html (24)
I/chromium( 4095): [INFO:CONSOLE(24)] "this this a console log...1545273615730", source: http://192.168.10.104/test.html (24)
D/ViewRootImpl@d8ee1fe[MainActivity]( 4095): ViewPostIme pointer 0
D/ViewRootImpl@d8ee1fe[MainActivity]( 4095): ViewPostIme pointer 1
I/flutter ( 4095): 运维页面show web
I/flutter ( 4095): this is webview dispose
D/InputMethodManager( 4095): HSIFW - flag : 0 Pid : 4095
V/InputMethodManager( 4095): Starting input: tba=android.view.inputmethod.EditorInfo@95fe15d nm : com.example.dfelectricapp ic=null
I/InputMethodManager( 4095): startInputInner - mService.startInputOrWindowGainedFocus
I/chromium( 4095): [INFO:CONSOLE(24)] "this this a console log...1545273617383", source: http://192.168.10.104/test.html (24)
I/chromium( 4095): [INFO:CONSOLE(24)] "this this a console log...1545273619384", source: http://192.168.10.104/test.html (24)
I/chromium( 4095): [INFO:CONSOLE(24)] "this this a console log...1545273621385", source: http://192.168.10.104/test.html (24)
I/chromium( 4095): [INFO:CONSOLE(24)] "this this a console log...1545273623384", source: http://192.168.10.104/test.html (24)
I/chromium( 4095): [INFO:CONSOLE(24)] "this this a console log...1545273625384", source: http://192.168.10.104/test.html (24)
I/chromium( 4095): [INFO:CONSOLE(24)] "this this a console log...1545273627383", source: http://192.168.10.104/test.html (24)
I/chromium( 4095): [INFO:CONSOLE(24)] "this this a console log...1545273629384", source: http://192.168.10.104/test.html (24)
I/chromium( 4095): [INFO:CONSOLE(24)] "this this a console log...1545273631384", source: http://192.168.10.104/test.html (24)
I/chromium( 4095): [INFO:CONSOLE(24)] "this this a console log...1545273633385", source: http://192.168.10.104/test.html (24)
I/chromium( 4095): [INFO:CONSOLE(24)] "this this a console log...1545273635384", source: http://192.168.10.104/test.html (24)
I/chromium( 4095): [INFO:CONSOLE(24)] "this this a console log...1545273637385", source: http://192.168.10.104/test.html (24)
I/chromium( 4095): [INFO:CONSOLE(24)] "this this a console log...1545273639385", source: http://192.168.10.104/test.html (24)
I/chromium( 4095): [INFO:CONSOLE(24)] "this this a console log...1545273641385", source: http://192.168.10.104/test.html (24)
I/chromium( 4095): [INFO:CONSOLE(24)] "this this a console log...1545273643385", source: http://192.168.10.104/test.html (24)
I/chromium( 4095): [INFO:CONSOLE(24)] "this this a console log...1545273645385", source: http://192.168.10.104/test.html (24)
You can see that I've quit the webview but the log is still being printed.
I try to solve this problem.So here's what I did.
In the webview_scaffold.dart
@override
void dispose() {
super.dispose();
webviewReference.reloadUrl(""); //! I add this line
_resizeTimer?.cancel();
webviewReference.close();
if (widget.hidden) {
_onStateChanged.cancel();
}
print("this is webview dispose");
webviewReference.dispose();
}
It worked,But I don't know the reason.
Am I right?
I want to know why the js consle log still being printed.
Thanks very much.
btw:
this is flutter doctor print:
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, v0.11.7, on Microsoft Windows [Version 10.0.17134.471], locale zh-CN)
[√] Android toolchain - develop for Android devices (Android SDK 28.0.3)
[√] Android Studio (version 3.2)
[√] Connected device (1 available)
• No issues found!
this is the dependencies:
flutter_webview_plugin: ^0.3.0+2
The text was updated successfully, but these errors were encountered:
I use the webview_scaffold to open a web.
the webpage contains contains a timer.
this is a html file I have used:
It means that change the display num and print some log per second.
this is my webviewPage.dart
when I open the webview to the html file,then I press the start button on this web.Finally I exit the webview.
this is my log:
You can see that I've quit the webview but the log is still being printed.
I try to solve this problem.So here's what I did.
In the webview_scaffold.dart
It worked,But I don't know the reason.
Am I right?
I want to know why the js consle log still being printed.
Thanks very much.
btw:
this is flutter doctor print:
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, v0.11.7, on Microsoft Windows [Version 10.0.17134.471], locale zh-CN)
[√] Android toolchain - develop for Android devices (Android SDK 28.0.3)
[√] Android Studio (version 3.2)
[√] Connected device (1 available)
• No issues found!
this is the dependencies:
flutter_webview_plugin: ^0.3.0+2
The text was updated successfully, but these errors were encountered: