js对接微信连wifi提示Uncaught SyntaxError: Unexpected token ILLEGAL
微信连wi-fi协议3.1供运营商portal呼起微信浏览器使用
*/
loadiframe = null;
noresponse = null;
putnoresponse(ev){
cleartimeout(noresponse); } function errorjump() { alert('该浏览器不支持自动跳转微信请手动打开微信\n如果已跳转请忽略此提示'); } myhandler = function(error) { errorjump(); }; function createiframe(){ var iframe = document.createelement(iframe); iframe.style.csstext = display:none;width:0px;height:0px;; document.body.appendchild(iframe); loadiframe = iframe; } //注册回调函数
jsonpcallback(result){
if(result && result.success){ alert('wechat will call up : ' + result.success + ' data:' + result.data); var ua=navigator.useragent; if (ua.indexof(iphone) != -1 ||ua.indexof(ipod)!=-1||ua.indexof(ipad) != -1) { //iphone document.location = result.data; }else{ if('false'=='true'){ alert('[强制]该浏览器不支持自动跳转微信请手动打开微信\n如果已跳转请忽略此提示'); return; } createiframe(); loadiframe.src=result.data; noresponse = settimeout(function(){ errorjump(); },3000); } }else if(result && !result.success){ alert(result.data); } }
wechat_gotoredirect(appid, extend, timestamp, sign, shopid, authurl, mac, ssid, bssid){
//将回调函数名称带到服务器端 var url = https://wifi.weixin.qq.com/operator/callwechatbrowser.xhtml?appid= + appid
&extend= + extend
×tamp= + timestamp
&sign= + sign;
//如果sign后面的参数有值,则是新3.1发起的流程 if(authurl && shopid){
= https://wifi.weixin.qq.com/operator/callwechat.xhtml?appid= + appid
&extend= + extend
×tamp= + timestamp
&sign= + sign
&shopid= + shopid
&authurl= + encodeuricomponent(authurl)
&mac= + mac
&ssid= + ssid
&bssid= + bssid;
} //通过dom操作创建script节点实现异步请求
script = document.createelement('script');
script.setattribute('src', url); document.getelementsbytagname('head')[0].appendchild(script);}
欢迎您
欢迎使用微信连wi-fi
一键打开微信连wi-fi
document.addeventlistener('visibilitychange', putnoresponse, false);
回复内容:
微信连wi-fi协议3.1供运营商portal呼起微信浏览器使用
*/
loadiframe = null;
noresponse = null;
putnoresponse(ev){
cleartimeout(noresponse); } function errorjump() { alert('该浏览器不支持自动跳转微信请手动打开微信\n如果已跳转请忽略此提示'); } myhandler = function(error) { errorjump(); }; function createiframe(){ var iframe = document.createelement(iframe); iframe.style.csstext = display:none;width:0px;height:0px;; document.body.appendchild(iframe); loadiframe = iframe; } //注册回调函数
jsonpcallback(result){
if(result && result.success){ alert('wechat will call up : ' + result.success + ' data:' + result.data); var ua=navigator.useragent; if (ua.indexof(iphone) != -1 ||ua.indexof(ipod)!=-1||ua.indexof(ipad) != -1) { //iphone document.location = result.data; }else{ if('false'=='true'){ alert('[强制]该浏览器不支持自动跳转微信请手动打开微信\n如果已跳转请忽略此提示'); return; } createiframe(); loadiframe.src=result.data; noresponse = settimeout(function(){ errorjump(); },3000); } }else if(result && !result.success){ alert(result.data); } }
wechat_gotoredirect(appid, extend, timestamp, sign, shopid, authurl, mac, ssid, bssid){
//将回调函数名称带到服务器端 var url = https://wifi.weixin.qq.com/operator/callwechatbrowser.xhtml?appid= + appid
&extend= + extend
×tamp= + timestamp
&sign= + sign;
//如果sign后面的参数有值,则是新3.1发起的流程 if(authurl && shopid){
= https://wifi.weixin.qq.com/operator/callwechat.xhtml?appid= + appid
&extend= + extend
×tamp= + timestamp
&sign= + sign
&shopid= + shopid
&authurl= + encodeuricomponent(authurl)
&mac= + mac
&ssid= + ssid
&bssid= + bssid;
} //通过dom操作创建script节点实现异步请求
script = document.createelement('script');
script.setattribute('src', url); document.getelementsbytagname('head')[0].appendchild(script);}
欢迎您
欢迎使用微信连wi-fi
一键打开微信连wi-fi
callwechatbrowser(){
wechat_gotoredirect('wxb069aeef0a797e59', 'demonew', '', '', '7360720', 'http://wifi.weixin.qq.com/assistant/wifigw/auth.xhtml?httpcode=200', 'ff:ff:ff:ff:ff:ff', '7360720', 'ff:ff:ff:ff:ff:ff');
}
document.addeventlistener('visibilitychange', putnoresponse, false);
搞定了 谢谢
其它类似信息