app 中嵌入H5页面,H5跳转H5页面的跳转实现
模拟创建a标签,并将href给到a标签点击实现;
var a = document.createElement('a');
a.setAttribute('href', 'http://www.XXX.com');
a.setAttribute('target', '_blank');
a.setAttribute('id', 'js_a');
//防止反复添加
if(document.getElementById('js_a')) {
document.body.removeChild(document.getElementById('js_a'));
}
document.body.appendChild(a);
a.click();
采用window.location.href 是不生效的。
版权声明:本文为Li_Ning21原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。