如何从iframe src页关闭iframe内容 [英] How to close IFrame cotent from IFrame src page

查看:97
本文介绍了如何从iframe src页关闭iframe内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



从一个站点,我在Page_Load时通过IFrame将aspx页面作为弹出窗口加载.在这里,iframe位于一个站点,即www.test.com.

但是IFrame src = http://DIfferentDomain/PopOver.aspx.两者都来自不同的域.但是我需要关闭该IFrame

单击PopOver.aspx中的Button时,可以从PopOver.aspx中获取.

我在www.test.com中有一个脚本插件,该脚本中我有一个类似
的功能

Hi,

From one site i am loading an aspx page as a popover through IFrame while Page_Load. Here, IFrame is in one site say www.test.com.

But IFrame src=http://DIfferentDomain/PopOver.aspx. Both are from different domains. But i need to close that IFrame

from PopOver.aspx when click on Button which is in PopOver.aspx.

I have a script plugin in www.test.com in that script i have a fuction like

divClose.onclick=

function(){

document.body.removeChild(document.getElementById(

"divOuterMain"));

document.body.removeChild(document.getElementById(

"layer"));

};



这里的"divClose"是www.test.com上的图像.我需要从PopOver.aspx访问该功能.

如果两个域都相同,则此脚本可以正常工作.但是,如果使用不同的域,则它不起作用.

请任何人帮助我....



Here "divClose" is image at www.test.com. I need to access that function from PopOver.aspx.

If both Domains are same this script is working fine. But if in case of different domain it is not working.

please any body help me ....

推荐答案

IE,并且我相信其他浏览器都具有限制跨域访问的安全设置.您无法通过代码来解决这个问题.您必须更改用户浏览器设置.
IE, and I believe other browsers, have security settings to restrict cross domain access. You can''t get around that through your code. You''ll have to make changes to the users browser settings.


这篇关于如何从iframe src页关闭iframe内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆