通常のjavascriptでiframeを作成しました。その iframe には、JQuery とともに Jquery 関数があります。コードは、期待どおりに iframe で機能します。iframe内ではなく、親ページに機能を実行させたい。iFrame とすべてのコンテンツは同じドメインから読み込まれますが、iframe を作成するコードは任意のサイトで実行できます。たとえば、siteB、siteA がコードを実行した場合、siteA & B は siteZ の Web サイト コンテンツへの iframe を作成できます。
親ページで実行したいiframeからこれまでのコードは次のとおりです。
<script>
$(document).ready(function(){
$().intad({
title: "blahblah",
url: "http://www.blah.com",
timeout: 30,
deplay: 2,
wait: 3,
closeable: true
});
});
</script>
iframeからこれを試しました:
<script>
$(document).ready(function(){
function intad(){
title: "blahblah",
url: "http://www.blah.com",
timeout: 30,
deplay: 2,
wait: 3,
closeable: true
});
});
</script>
そして、これは親ページに読み込まれるコードから:
<script>
parent.document.getElementById("RandomIdHere").contentWindow.intads();
</script>