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

Unable to load initialFile #56

Closed
hiaw opened this issue Mar 11, 2019 · 3 comments
Closed

Unable to load initialFile #56

hiaw opened this issue Mar 11, 2019 · 3 comments

Comments

@hiaw
Copy link

hiaw commented Mar 11, 2019

I was trying to load a local page. I've added the file to assets folder and specified in pubspec.yaml. But I was unable to load it. The following is the code I used and the error message.

    child: InAppWebView(
        initialFile: "assets/index.htm",
        initialHeaders: {},
        initialOptions: {},
        onWebViewCreated: (InAppWebViewController controller) {
          webView = controller;
        },
        onLoadError: (InAppWebViewController controller, String url,
            int code, String message) {
          print(message);
          print(code);
          print(url);
        },
      ),
flutter: The URL can’t be shown
flutter: 101
flutter: assets/index.html
@pichillilorenzo
Copy link
Owner

You wrote initialFile: "assets/index.htm". Are you sure that the file extension is htm and not html?? Maybe is it a typo?

@hiaw
Copy link
Author

hiaw commented Mar 11, 2019

I've tried both html and htm, it didn't matter.

I've create a sample app to illustrate the problem.
https://github.com/hiaw/flutter_inappbrowser_loadfile_test

@pichillilorenzo
Copy link
Owner

Thanks! I fixed this issue with new version 1.0.1!

However, you need to update your Android build.gradle file and set minSdkVersion 17 here, otherwise you will have an error during Android build!

This was referenced Jul 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants