• 【html】使ifram搭建的项目,新页面跳出框架


    方法一:
    <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

  • 相关阅读:
    python 内存泄漏——使用pymssql模块的讨论 free(): corrupted unsorted chunks
    Python的gc模块
    使用多线程——线程池
    sqlserver 数据库连接池
    drf response——简单封装
    邮箱找回密码实现
    阿里云 oss 服务 —— 上传图片,获取url
    dajngo-apscheduler 实现定时任务
    kubernetes基础概念
    Path must be a string.
  • 原文地址:https://www.cnblogs.com/websmile/p/8638108.html
Copyright © 2020-2023  润新知