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

webview_flutter 0.3.4 Flutter: Web view application only a particular website(main url) run in the application, others open in local browser of phone #347

Closed
amankataria opened this issue Mar 12, 2019 · 8 comments

Comments

@amankataria
Copy link

I have a web view application in Flutter. The plugin/package is "flutter_webview_plugin". In Webview Scaffold, I have url= 'www.google.com'. Now I want that any URL which doesn't contain "google.com" opens in the local browser of the phone.

Maybe if I can restrict the Web view plugin if URL doesn't contain "google.com"

Please let me know how can I achieve this.

Here is my code:

 WebviewScaffold(
    url: "http://www.google.com")

Further Clarification: I have a web view application. So the website that I have, has a lot of links in it. I don't want links other than my domain links to load in webview app. I want it to open externally.

Link to issue first reported: https://stackoverflow.com/questions/55125577/flutter-web-view-application-only-a-particular-website-run-in-the-application

@hnvn
Copy link
Member

hnvn commented Mar 22, 2019

Check my fork: https://github.com/hnvn/flutter_webview_plugin, use invalidUrlRegex to restrict your working urls

@amankataria
Copy link
Author

@hnvn How exactly can I implement this in my project?
I apologize, I am new to all this, so its difficult to get it.

@charafau
Copy link
Collaborator

@hnvn is this your PR which is fixing this? #292 I would like to merge it, but could you please rebase with master ?

@hnvn
Copy link
Member

hnvn commented Mar 24, 2019

Done

@charafau
Copy link
Collaborator

Thank you, I will test it today and merge if it's alright.

@amankataria
Copy link
Author

amankataria commented Apr 18, 2019

@charafau is the feature added in the main package? I am still not exactly sure how can I implement this in my app.

@AlejandroC90
Copy link

@charafau is the feature added in the main package? I am still not exactly sure how can I implement this in my app.

Did you solved this?

@charafau
Copy link
Collaborator

@amankataria @AlejandroC90 yes it's part of main package (in 0.3.2)

PRs was only for restricting urls to be loaded. Write your regex and and check if your url is validated, when open webview (with restriction so user wont redirect to custom domains) otherwise open browser with url_launcher plugin

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

4 participants