Supporting New Window
Choose Safe Browser Mode
This guide is for the general-purpose web view.
To get full support for a new window or new tab, we suggest you choose to use the Safe Browsing Mode, which gives a browser level experience.
Links with "_blank" attribute
In a general web browser (like Chrome or Safari), a URL with
target="_blank" attribute is intended to be opened in a new tab. However, in the context of web view, there is no way to handle new tabs without proper configurations. Due to that, by default UniWebView will ignore the
target="_blank" and try to open the page in the same web view if that kind of link is pressed.
This works for most cases, but if this is a problem to your app logic, and you need to handle the new tab, you can change this behavior by calling
It enables the "opening in new tab" behavior in a limited way, by adding the new tab web view above to the current web view, with the same size and position. When the opened new tab is closed, it will be removed from the view hierarchy automatically.
The new tab web view is just a temporary layer: it is not a fully functional
window.close(). Otherwise, the original web view will be always covered and invisible.
window.open will ask the web view to open a new window. To support it, make sure you pass
true as the second parameter (
SetSupportMultipleWindows method. On some devices, you also need to call
For more about this topic, please check the API reference of