[英]Target _blank doesn't open in new tab/window
I am using the following code in my ionic project to open the new system browser and post the values.我在我的 ionic 项目中使用以下代码打开新的系统浏览器并发布值。 For some reason the the new windows doesn't open.
出于某种原因,新窗口无法打开。
I don't get any kind of errors.我没有任何错误。 The link does open but in self browser.
该链接确实打开,但在自我浏览器中。 I want it to open in the android system browser.
我希望它在android系统浏览器中打开。
var mapForm = document.createElement("form");
mapForm.target = "_blank";
mapForm.method = "POST";
mapForm.action = "http://www.example.com/api/form.php";
// Create an input
var firstname = document.createElement("input");
var lastname = document.createElement("input");
var address = document.createElement("input");
var email = document.createElement("input");
firstname.type = "text"; firstname.name = "firstname"; firstname.value = "John";
lastname.type = "text"; lastname.name = "lastname"; lastname.value = "Doe";
email.type = "text"; email.name = "email"; email.value = "user@example.com";
// Add the input to the form
mapForm.appendChild( firstname );
mapForm.appendChild( lastname );
mapForm.appendChild( email );
// Add the form to dom
document.body.appendChild(mapForm);
// Just submit
mapForm.submit();
Using _system
will work.使用
_system
将起作用。
Here is an example:下面是一个例子:
window.open(url,'_system','location=yes'),!1;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.