Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS about:blank popup not loading page #1500

Closed
2 tasks done
xxunghee opened this issue Jan 5, 2023 · 8 comments
Closed
2 tasks done

iOS about:blank popup not loading page #1500

xxunghee opened this issue Jan 5, 2023 · 8 comments
Labels
bug Something isn't working

Comments

@xxunghee
Copy link

xxunghee commented Jan 5, 2023

  • I have read the Getting Started section
  • I have already searched for the same problem

Environment

Technology Version
Flutter version 3.3.9
Plugin version flutter_inappwebview: ^5.7.1+1
url_launcher: ^6.1.7
Android version Android Studio Dolphin ( 2021.3.1 Patch 1 )
iOS version 16.2
macOS version 13.1
Xcode version 14.2

Device information:

Description

Expected behavior:

  • Show popup window with content.
  • In Android, it works

Current behavior:

  • Empty page (iOS)

Steps to reproduce

Sample code

show

main.dart (whole)

 import 'dart:async';

import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:url_launcher/url_launcher.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'iOS about_blank Sample',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key});

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {

  InAppWebViewController? _inAppWebViewController;

  final Completer<InAppWebViewController> _controller =
  Completer<InAppWebViewController>();

  String initUrl = 'https://postcode.map.daum.net/guide';

  InAppWebViewGroupOptions options = InAppWebViewGroupOptions(
    crossPlatform: InAppWebViewOptions(
      preferredContentMode: UserPreferredContentMode.MOBILE,
      cacheEnabled: true,
      mediaPlaybackRequiresUserGesture: true,
      javaScriptEnabled: true,
      javaScriptCanOpenWindowsAutomatically: true,
      useShouldOverrideUrlLoading: true,
    ),
    android: AndroidInAppWebViewOptions(
      useHybridComposition: false,
      supportMultipleWindows: true,
      domStorageEnabled: true,
      databaseEnabled: true,
      cacheMode: AndroidCacheMode.LOAD_CACHE_ELSE_NETWORK,
      mixedContentMode: AndroidMixedContentMode
          .MIXED_CONTENT_ALWAYS_ALLOW,
    ),
    ios: IOSInAppWebViewOptions(
      applePayAPIEnabled: true,
      allowsInlineMediaPlayback: true,
      ignoresViewportScaleLimits: true,
      sharedCookiesEnabled: true,
    ),
  );

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: InAppWebView(
        initialUrlRequest: URLRequest(url: Uri.parse(initUrl)),
        initialOptions: options,
        onWebViewCreated: (InAppWebViewController controller) {
          _controller.future.then((value) => _inAppWebViewController = value);
          _controller.complete(controller);
        },
        onLoadStart: (controller, url) {
          print("@Parent onLoadStart() $url");
        },
        onLoadStop: (controller, url) {
          print('@Parent onLoadStop() $url');
        },
        onLoadError: (controller, url, code, message) { /* do nothing */ },
        onLoadHttpError: (controller, url, code, message) { /* do nothing */ },
        onProgressChanged: (controller, progress) { /* do nothing */ },
        onCreateWindow: (controller, createWindowRequest) async {
          print("@Parent onCreateWindow(), $createWindowRequest");
          await _showPopUpWindow(context, createWindowRequest, controller);
          return true;
        },
        onCloseWindow: (controller) {
          print('@Parent onCloseWindow()');
          closeInAppWebView();
        },
      ),
    );
  }

  _showPopUpWindow(BuildContext context, CreateWindowAction createWindowRequest, InAppWebViewController controller) async {
    showDialog(
      barrierDismissible: true,
      context: context,
      builder: (context) {
        return Scaffold(
          body: Stack(
            children: [
              InAppWebView(
                windowId: createWindowRequest.windowId,
                initialOptions: options,
                onWebViewCreated: (controller) {
                  _inAppWebViewController = controller;
                },
                onCreateWindow: (controller, windowAction) async {
                  print("#popup onCreateWindow()");
                  return true;
                },
                onLoadStart: (controller, url) {
                  print('#popup onLoadStart() $url');
                },
                onLoadError: (controller, url, code, message) {
                  /* do nothing */
                },
                onLoadHttpError: (controller, url, code, message) {
                  /* do nothing */
                },
                onLoadStop: (controller, url) {
                  print("#popup onLoadStop() $url");
                },
                onCloseWindow: (controller) async {
                  print('#popup onCloseWindow()');
                  await _controller.future
                      .then((value) => _inAppWebViewController = value);
                  Navigator.pop(context, null);
                },
              ),
              Positioned(
                top: 5,
                right: 10,
                child: IconButton(
                  icon: const Icon(Icons.cancel, color: Colors.black),
                  onPressed: () {
                    _inAppWebViewController = controller;
                    Navigator.pop(context, null);
                  },
                ),
              ),
            ],
          ),
        );
      },
    );
  }
}


  1. Run sample code
  2. Scroll down to below page

3. click [우편번호 찾기](red box) button
4. Webview shows popup window without any contents.

Stacktrace/Logcat

  • Android
I/flutter ( 2141): @Parent onLoadStart() https://postcode.map.daum.net/guide
I/flutter ( 2141): @Parent onLoadStop() https://postcode.map.daum.net/guide
I/flutter ( 2141): @Parent onCreateWindow(), {request: { ... } ... }
  • iOS
flutter: @Parent onLoadStart() https://postcode.map.daum.net/guide
flutter: @Parent onLoadStop() https://postcode.map.daum.net/guide
flutter: @Parent onCreateWindow(), {request: { ... } ... }
flutter: #popup onLoadStart()
flutter: #popup onLoadStop() about:blank
@xxunghee xxunghee added the bug Something isn't working label Jan 5, 2023
@github-actions
Copy link

github-actions bot commented Jan 5, 2023

👋 @xxunghee

NOTE: This comment is auto-generated.

Are you sure you have already searched for the same problem?

Some people open new issues but they didn't search for something similar or for the same issue. Please, search for it using the GitHub issue search box or on the official inappwebview.dev website, or, also, using Google, StackOverflow, etc. before posting a new one. You may already find an answer to your problem!

If this is really a new issue, then thank you for raising it. I will investigate it and get back to you as soon as possible. Please, make sure you have given me as much context as possible! Also, if you didn't already, post a code example that can replicate this issue.

In the meantime, you can already search for some possible solutions online! Because this plugin uses native WebView, you can search online for the same issue adding android WebView [MY ERROR HERE] or ios WKWebView [MY ERROR HERE] keywords.

Following these steps can save you, me, and other people a lot of time, thanks!

@hm122
Copy link

hm122 commented Jan 6, 2023

Facing the same issue.

@alexrafuse
Copy link

Facing the same issue, any update?

@iapb1021
Copy link

iapb1021 commented May 24, 2023

ios/Runner/Info.plist
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>

@abdulahath
Copy link

is this issue resolved in 6.0.0-beta.23 ?

jin-motemote pushed a commit to jin-motemote/flutter_inappwebview that referenced this issue Nov 24, 2023
ps9310 pushed a commit to mayank4741/flutter_inappwebview that referenced this issue Feb 24, 2024
@divpa
Copy link

divpa commented Apr 18, 2024

@pichillilorenzo can you please tell me how this issue is resolved, I am finding here but not getting any solution ?

@divpa
Copy link

divpa commented Apr 19, 2024

@pichillilorenzo can you please tell me how this issue is resolved, I am finding here but not getting any solution ?
Hi @pichillilorenzo I am eagerly waiting for your reply, please tell me is it resolved , because I have checked same thing on latest version but getting same blank pop up, your help in this matter will highly appreciated.

Copy link

github-actions bot commented Oct 4, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants