首页 > 其他分享 >网页支付宝支付,通过form表单提交,在苹果手机上无法跳转

网页支付宝支付,通过form表单提交,在苹果手机上无法跳转

时间:2023-02-23 12:13:23浏览次数:33  
标签:form ios 表单 forms 跳转 var document

1.首先判读是否为ios系统

var u = navigator.userAgent;
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端

 

2.判断如何是ios系统,则不新开页面,直接跳转

const div=document.createElement('divform');
div.innerHTML=msg.content; // data就是接口返回的form 表单字符串
document.body.appendChild(div);


//如果是ios,不新开页面直接跳转
if(isiOS){
document.forms[0].submit();
}else{
document.forms[0].setAttribute('target', '_blank') // 新开窗口跳转
document.forms[0].submit();
}

 

转自:https://www.cnblogs.com/fxty/p/12068235.html

标签:form,ios,表单,forms,跳转,var,document
From: https://www.cnblogs.com/shiyi2014/p/17147450.html

相关文章