javascript,iframe - 从iframe导航/关闭父窗口 [英] javascript, iframe - navigate/close parent window from iframe

查看:119
本文介绍了javascript,iframe - 从iframe导航/关闭父窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有这样的设置:

一页文字/还包括一个iframe(iframe中的页面由我创建,所以我可以访问它,我可以修改它的内容)。



我需要做的是当我从iframe中访问一个链接以在母版页上打开它时(导航)。

到目前为止,我没有做到这一点,所以任何帮助将不胜感激。



有关更多信息,请直接询问。

解决方案

在所有您想要影响父窗口的链接中,执行如下操作:

 < a href =somthing.htmltarget =_ parent> GO THERE!< / a> 

或用javascript:

 < a href =javascript:window.parent.location ='somthing.html'; > GO SOMEWHERE!< / a> 


Good day to all.

I have this setup:

One page with text/whatever, that also includes an iframe (the page in iframe is created by me so I have access to it, I can modify its content).

What I need to do is that when I access a link from the iframe to open it on the mother page (navigate).

Until now I kind of failed to do that so any help would be appreciated.

For any further info just ask.

解决方案

In all of the links that you want to affect the parent window do something like this:

<a href="somthing.html" target="_parent">GO THERE!</a>

Or with javascript:

<a href="javascript:window.parent.location = 'somthing.html';" >GO SOMEWHERE!</a>

这篇关于javascript,iframe - 从iframe导航/关闭父窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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