Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 将登录凭据传递到iframe以进行自动登录_Javascript_Jquery_Iframe_Superset - Fatal编程技术网

Javascript 将登录凭据传递到iframe以进行自动登录

Javascript 将登录凭据传递到iframe以进行自动登录,javascript,jquery,iframe,superset,Javascript,Jquery,Iframe,Superset,我想为超集创建自动登录页面,下面是我尝试的内容 <form id="login" target="frame" method="post" action="http://superset.com/login"> <input type="hidden" name="username" value="login" />

我想为超集创建自动登录页面,下面是我尝试的内容

<form id="login" target="frame" method="post" action="http://superset.com/login">
    <input type="hidden" name="username" value="login" />
    <input type="hidden" name="password" value="pass" />
</form>

<iframe id="frame" name="frame"></iframe>

<script type="text/javascript">
    // submit the form into iframe for login into remote site
    document.getElementById('login').submit();

    // once you're logged in, change the source url (if needed)
    var iframe = document.getElementById('frame');
    iframe.onload = function() {
        if (iframe.src != "http://superset.com/list") {
            iframe.src = "http://superset.com/list";
        }
    }
</script>

//将表单提交到iframe以登录到远程站点
document.getElementById('login').submit();
//登录后,更改源url(如果需要)
var iframe=document.getElementById('frame');
iframe.onload=函数(){
如果(iframe.src!“http://superset.com/list") {
iframe.src=”http://superset.com/list";
}
}
这段代码在Firfox中运行得很好,但在chrome或Safri中却不起作用,我不知道为什么

框架打开,即使我尝试手动登录,也无法工作

我尝试从另一个窗口登录,它在chrome中工作,但会话没有被保存到iframe的浏览器中,即使它在Firfox中也能工作

有什么问题