tidev / titanium-sdk

🚀 Native iOS and Android Apps with JavaScript
https://titaniumsdk.com/
Other
2.76k stars 1.21k forks source link

feat(android): new WebView property 'multipleWindows' #14005

Open m1ga opened 8 months ago

m1ga commented 8 months ago

For 14 years the default value for setSupportMultipleWindows() is true which always tries to create new windows when clicking on a link with target _blank inside a webview. That breaks most webviews so you have to remove target="_blank" or change JS.

The new property multipleWindows will allow the user to just set it to false

Test

var win = Ti.UI.createWindow();
var www = Ti.UI.createWebView({
  multipleWindows: false,
  html:"<div onclick=\"window.open('https://player.autopod.xyz/523959', '_blank', 'location=yes,height=810,width=470,scrollbars=no, resizable=no,status=yes');\">click me</div>"
});

win.add(www);
win.open();

In 12.3.0.GA or if you set it to true (default) it will just show a new black page. If you set it to false it will open the link in the same window/webview.