Flutter webivew not showing content from my site

752 views Asked by At

I am trying to load my website content in my flutter application.

I have a link https://dev.demo.hello.example.com/id/4

I have tried using flutter_webview_plugin & webview_flutter both plugins but on both plugins i am getting below error :

WF: === Starting WebFilter logging for process Runner
WF: _userSettingsForUser mobile: {
    filterBlacklist =     (
    );
    filterWhitelist =     (
    );
    restrictWeb = 1;
    useContentFilter = 0;
    useContentFilterOverrides = 0;
    whitelistEnabled = 0;
}
WF: _WebFilterIsActive returning: NO

I have also tried mentioned ATS related things in info.plist

<key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
    </dict>

But still facing the same issue. I have https in my link.

Is there any work around ?

2

There are 2 answers

0
Dee Fend Ahmad On

Yes, just put this code to your navigationDelegate in WebView widget

navigationDelegate: (NavigationRequest request) {
   if (request.url == get.url) {
      return NavigationDecision.navigate;
   }
   return NavigationDecision.prevent;
}

it work for me on IoS & Android

0
Nicolas Youpi On

In my case, I was setting a navigationDelegate to prevent all further navigation :

WebView(
  initialUrl: url,
  javascriptMode: JavascriptMode.unrestricted,
  navigationDelegate: (navigation) => navigation.url == url ? NavigationDecision.navigate : NavigationDecision.prevent,
),

It works fine on Android, the initialUrl gets loaded, and any further navigation is blocked.

But on iOS I had to change this code as it was blocking even initialUrl :

WebView(
  initialUrl: url,
  javascriptMode: JavascriptMode.unrestricted,
  navigationDelegate: (navigation) => navigation.url == url ? NavigationDecision.navigate : NavigationDecision.prevent,
),