简体   繁体   中英

Flutter: Link inside the webview opens to built in browser instead of the webview

I have created a webview using flutter, i want to display a local webapp for now to my created webview.

import 'package:flutter/material.dart';
import 'package:flutter_webview_plugin/flutter_webview_plugin.dart';
import 'package:webview_flutter/webview_flutter.dart';

class EnableJavacriptWebView extends StatefulWidget {
  @override
  EnableJavacriptWebViewState createState() {
    return new EnableJavacriptWebViewState();
  }
}

class EnableJavacriptWebViewState extends State<EnableJavacriptWebView> {
  bool _isJSEnabled = true;

  _onChanged() {
    setState(() {
      _isJSEnabled = !_isJSEnabled;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text("TEST")),
      body: Stack(
        children: [
          WebView(
            initialUrl: 'https://flutter.io/',
            javascriptMode: _isJSEnabled
                ? JavascriptMode.unrestricted
                : JavascriptMode.disabled,
          ),
        ],
      ),
    );
  }
}

but what happen is when i load the application(webview) it opens the Builtin browser instead of the inside webview application.

webview_flutter中使用了旧版本的flutter_webview_pluginpubspec.yaml应该使用最新版本。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM