2017-01-18 16 views
1

私のコードは自動的に送信されません。私のコードに何が問題なのですか?私はiframe経由でリモートWebサイトにログインしようとしています。コードは自動的に送信されません

<form id="login" target="frame" method="post" action="https://remote.com"> 
<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 != "https"//remote.com") { 
    iframe.src = "https://remote.com"; 
} 
} 
</script> 
+0

あなたがそれを行うことになっていません。 – Narf

答えて

0

をお試しくださいhttpが送信されます

iframe srcのhttpsリンクで問題が発生しました

ページがhttpの場合、httpsコンテンツのiframeが許可されます。

あなたのページがhttpsの場合、httpコンテンツは許可されません。

以下の可能性を記入してください。

page - iframe - status 

http - http - allowed 
http - https - allowed 
https- http - not allowed 
https- https - allowed 

リファレンス==>Click here

+0

私のページはhttpで、httpsにアクセスしようとしていますか?それは動作しませんでしたか? – jinggoyestrada

+0

参照リンク –

+0

で見ることができます。私の送信? – jinggoyestrada

0

私はあなたのコードは、あなたがあなたのコードが自動的に提出するかどうか試してみたい場合は、との任意のリンクを使用することができ、自動的に

を提出しているあなたのコードを試してみてください。この

<script> 
$(document).ready(function(){ 
$("#login").submit(); 
}); 

+0

まだ動作していませんサーフ:( – jinggoyestrada

関連する問題