>  기사  >  백엔드 개발  >  js对接微信连wifi提示Uncaught SyntaxError: Unexpected token ILLEGAL

js对接微信连wifi提示Uncaught SyntaxError: Unexpected token ILLEGAL

WBOY
WBOY원래의
2016-06-06 20:24:391443검색

<code><script type="text/javascript">
    /**</script></code>
    • 微信连Wi-Fi协议3.1供运营商portal呼起微信浏览器使用
      */

    1. loadIframe = null;

    2. noResponse = null;

    3. putNoResponse(ev){

      <code>      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;
        }
       //注册回调函数</code>
    4. jsonpCallback(result){

      <code>     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);
           }
       }
       </code>
    5. Wechat_GotoRedirect(appId, extend, timestamp, sign, shopId, authUrl, mac, ssid, bssid){

      <code>     
           //将回调函数名称带到服务器端
           var url = "https://wifi.weixin.qq.com/operator/callWechatBrowser.xhtml?appId=" + appId </code>
      • "&extend=" + extend

      • "×tamp=" + timestamp

      • "&sign=" + sign;

        <code>   
           //如果sign后面的参数有值,则是新3.1发起的流程
           if(authUrl && shopId){
               
               </code>
      1. = "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;

          <code>       
             }            
             
             //通过dom操作创建script节点实现异步请求  </code>
      1. script = document.createElement('script');

        <code>    script.setAttribute('src', url);  
            document.getElementsByTagName('head')[0].appendChild(script);
        }</code>




        <code><img class="mod-simple-follow-page__banner-bg" src="https://wifi.weixin.qq.com/resources/images/background.jpg" alt="">
        <div class="mod-simple-follow-page__img-shadow"></div>
        <div class="mod-simple-follow-page__logo">
            <img class="mod-simple-follow-page__logo-img" src="https://wifi.weixin.qq.com/resources/images/t.weixin.logo.png" alt="">
            <p class="mod-simple-follow-page__logo-name"></p>
            <p class="mod-simple-follow-page__logo-welcome">欢迎您</p>
        </div></code>


        <code><p class="mod-simple-follow-page__attention-txt">欢迎使用微信连Wi-Fi</p>
        <a class="mod-simple-follow-page__attention-btn" onclick="callWechatBrowser()">一键打开微信连Wi-Fi</a></code>



    성명:
    본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.