How to open multiple WebViews on flutter?

Posted by Jessica Taylor | Updated on

How to open multiple WebViews on flutter?

You can use my plugin flutter_inappwebview, which is a Flutter plugin that allows you to add inline WebViews or open an in-app browser window and has a lot of events, methods, and options to control WebViews.

It implements the onCreateWindow event, that is an event fired when the WebView requests the host application to create a new window, for example when trying to open a link with target=”_blank” or when is called by JavaScript side.

Here is an example where I load a simple initial HTML (just for the sake of the example) that has a button , that when it is clicked, it opens a new WebView inside an AlertDialog. With this new WebView you can listen to URL changes through the onLoadStop event or using the shouldOverrideUrlLoading event or you can check and get a specific cookie after the user as logged in. You can put whatever logic in this new WebView.

Here is the code example:

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@] Your question and answer will appear on and help other developers.

Related Questions & Answers