zoukankan      html  css  js  c++  java
  • sarafi浏览器iframe跨域cookie无效的处理方案(笨方法,看官莫笑)

    <script>
        $(function(){
            url = 'oauth_authorize_api';
            loaded = false;
            iframe = '<iframe id="login" width="100%" height="500" src="' + url + '"></iframe>';
            $(".test").click(function(){
                if(loaded) return false;
                if(!/chrome/d+/.test(navigator.userAgent.toLowerCase()) && /safari/d+/.test(navigator.userAgent.toLowerCase())) {
                    myWindow = window.open(url,"myWindow",'width=1,height=1');
                    setTimeout(function(){
                        myWindow.close();
                        $("#iframe").append(iframe);
                    },1000);
                } else {
                    $("#iframe").append(iframe);
                }
                loaded = true;
            });
        })
    </script>
    <a class="test" href="#">登录</a>
    
    <div id="iframe"></div>
    

      

  • 相关阅读:
    day_13
    day_12
    day_11
    day_10
    day_09
    day_08
    day_07
    day_06
    cmder 基本配置和使用
    php自动加载
  • 原文地址:https://www.cnblogs.com/flytome/p/5133929.html
Copyright © 2011-2022 走看看