Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

use WebView in flutter web without using iframe

Is there a way to use WebView in Web Filter without the need for an iframe? Most of the methods available by iframe display website information and many sites also prohibit the use of iframe .

I'm looking for a way to use website information directly and without the need for iframe

I also tested the lower libraries and it didn't work

easy_web_view2

easy_web_view

webviewx

web_browser

in app webview

and ...

I dont have problem to show webview in Flutter webI have trouble displaying sites that have disabled the iFrame feature on their site .

enter image description here

like image 883
hadi Avatar asked Nov 07 '21 13:11

hadi


People also ask

Does flutter support WebView?

Introduction. With the WebView Flutter plugin you can add a WebView widget to your Android or iOS Flutter app. On iOS the WebView widget is backed by a WKWebView, while on Android the WebView widget is backed by a WebView. The plugin can render Flutter widgets over the web view.


Video Answer


1 Answers

The flutter web directly not support any web view to load url. You have to use HtmlElementView to load URL.

import 'dart:ui' as ui;

@override
  void initState() {
    super.initState();
    
    ui.platformViewRegistry.registerViewFactory('openstreetmap', (int viewId) {
      return IFrameElement()
        ..style.width = '100%'
        ..style.height = '100%'
        ..src = 'https://www.openstreetmap.org/export/embed.html?bbox=-0.004017949104309083%2C51.47612752641776%2C0.00030577182769775396%2C51.478569861898606&layer=mapnik
'
        ..style.border = 'none';
    });
  }

  @override
  Widget build(BuildContext context) {
    return HtmlElementView(viewType: 'openstreetmap');
  }
like image 186
Ghanshyam Bhesaniya Avatar answered Sep 19 '22 15:09

Ghanshyam Bhesaniya