js 跳转外部页面的方式

js 跳转外部页面的方式

普通跳转不需要携带参数的跳转

window.location='http://supermatchusa.com/activity/turntable/#/pages/index/rule'
window.location.href="bloomer://recharge/coins"

以上两种情况是指普通跳转外部链接且不需要携带参数的情况

下边这一种是携带参数的跳转方式

var url= encodeURIComponent("{\"name\":\"Turntable\",\"webUrl\":\"http://supermatchusa.com/activity/turntable/#/pages/index/winningList\"}")
 window.location="bloomer://com.s.video.bloomer/NetWeb/params?webInfoJson="+url+"&doings=Turntable"

携带参数稍微麻烦一点 首先需要encodeURIComponent()方法加密一下 第二点就是符号之间需要反斜杠 隔离一下 根据自己的地址配置 重点就是http的链接地址会被转义成乱码 获取的地方会拿不到参数

猜你喜欢

转载自blog.csdn.net/ranmoli/article/details/116457035