方法一:
<a href="<?php echo $baseUrl . '#/study/order';?>" target="_parent">新頁面</a>
方法二:
top.location.href=”url” 在頂層頁面打開url(跳出框架)
擴展:
top.location.href=”url” 在頂層頁面打開url(跳出框架)
self.location.href=”url” 僅在本頁面打開url地址
parent.location.href=”url” 在父窗口打開Url地址
this.location.href=”url” 用法和self的用法一致
if (top.location == self.location)
判斷當前location 是否為頂層來 禁止frame引用
如果頁面當中有自定義的frame的話,也可以將parent self top換為自定義frame的名稱 效果就是在自定義frame窗口打開url地址
實際中可能這樣使用
if(top !== self){
top.location.href = location.href;
} //禁止frame引用
ps:
top表示主窗口,location表示當前窗口,如果你的文件只有一個框架,沒有iframe和frmaeset,那么是完全一致的,沒有區別。
top.location是在頂層frame中打開新頁 window.location是在當前frame中打開新頁
parent.location 在當前窗口的父窗口打開Url地址
top表示主窗口,location表示當前窗口,如果你的文件只有一個框架,沒有iframe和frmaeset,那么是完全一致的,沒有區別。
參考鏈接:https://www.cnblogs.com/hlws/p/5943141.html
作者:smile.轉角
QQ:493177502