これが私のコードですhttp://my-localhost.com/iframe-test.html
<html>
<head><title>Welcome Iframe Test</title></head>
<body>
<iframe src="http://www.my-website.com/index.html" width="500" height="500"></iframe>
<script type="text/javascript">
function alertMyMessage(msg){
alert(msg);
}
</script>
</body>
</html>
ここにコードがありますhttp://www.my-website.com/index.html
<html>
<head></title>Welcome to my Server</title></head>
<body>
<h1>Welcome to My Server</ht>
<a href="javascript:void(0)" title="Click here" onClick="parent.alertMyMessage('Thanks for Helping me')">Click Here</a>
</body>
</html>
「ここをクリック」リンクをクリックすると。次のエラーが発生しました。
Uncaught SecurityError: 発信元が " http://www.my-website.com " のフレームが、発信元が " http://my-localhost.com "のフレームにアクセスするのをブロックしました。プロトコル、ドメイン、およびポートが一致する必要があります。
この問題を解決するために私を助けてください。または、これに対する他の解決策を教えてください。