我在我的iframe中有一个下面的代码,它包含一些jQuery,我想从iframe到父页面调用它,但它不起作用,iframe的路径是content/test/doubleimg.html
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="https://www.example.com/content/test/base64.js"></script>
<script type="text/javascript" src="https://www.example.com/content/test/doubleimg.js"></script>和双img包含一些jQuery函数,这是执行加载的页面,它可以很好地工作,但如果我把它在iframe,它不工作。
和我的html标记一样,父文件的路径是template/category.html
<div id="Container">
-----------
-----------
<div class="Content" id="LayoutColumn2">
<iframe id="theiframe" allowtransparency="true" target="_top" src="/content/test/doubleimg.html" frameborder="0" height="0" width="0"></iframe>
</div>
</div>因此,请建议我的想法,我如何使用jQuery从iframe和我的jQuery是在页面加载执行。
实际上我正在尝试调用Bigcommerce的api,但是我需要设置https,并且我不能设置它,因为在Bigcommerce中不允许在类别页面url中设置https
如果我没有设置https,那么API返回一个401 authentication error
所以请帮我解决这个问题。
发布于 2013-12-23 21:08:12
发布于 2013-12-23 21:05:22
尝尝这个
window.parent.document.wirte('<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>');https://stackoverflow.com/questions/20744084
复制相似问题