背景
A,B,C,D都是jsp,D是C的iframe,C是B的iframe,B是A的iframe,在D中跳转页面的写法如下:
js跳转
window.location.href、location.href
,本页面跳转;parent.location.href
,上一层页面跳转。即C页面跳转;top.location.href
,最外层页面跳转;即A页面跳转;
连接<a>
或者form
跳转
D页面中要有form
<form>
:form 提交后,D页面跳转;<form target="_blank">
:form提交后弹出新页面;<form target="_parent">
: form 提交后上层页面跳转,即C页面跳转;<form target="_top">
:form 提交后,最外层页面跳转,即A页面跳转;
刷新
parent.location.reload()
:C页面刷新window.opener.document.locaion.reload()
:C页面刷新(使用子窗口的opener对象来获取父窗口对象)top.location.reload()
:A页面刷新