1. 页面被iframe问题解决方法

     if (window.top.location !== window.self.location) {
    const data = JSON.stringify({ iframedRedirectSuccess: true });
    window.top.location.href = addURLParam(window.self.location.href, 'data', data);
    }
  2. 页面初始化获取参数

     import URL from 'url-parse';
    const {
    origin, protocol, host, hostname, port, query, hash,
    } = new URL(document.URL, true); const hostInfo = {
    origin, protocol, host, hostname, port, query, hash,
    };
  3. 页面无刷新删除url上参数(仅适用于无跨域更换url及参数)

      import qs from 'querystringify';
    import omit from 'lodash/omit';
    const param = omit(qs.parse(window.location.search), ['data']);
    const paramStr = qs.stringify(param, '?');
    const url = `${window.location.pathname}${paramStr}`;
    // This is for firefox will reload previous url when we click refresh button or press F5
    // after we use replaceState to replace a new url issue.
    window.location.hash = window.location.hash; // eslint-disable-line
    window.history.replaceState && window.history.replaceState({}, null, url);

页面被iframe与无刷新更换url方法的更多相关文章

  1. js修改url参数,无刷新更换页面url

    一.js修改地址栏URL参数 function changeURLPar(destiny, par, par_value) { var pattern = par + '=([^&]*)'; ...

  2. 通过history.pushState无刷新改变url

    通过history.pushState无刷新改变url 背景 在浏览器中改变地址栏url,将会触发页面资源的重新加载,这使得我们可以在不同的页面间进行跳转,得以浏览不同的内容.但随着单页应用的增多,越 ...

  3. HTML5无刷新修改Url,history pushState/replaceState

    一.认识window.history window.history表示window对象的历史记录,是由用户主动产生,并且接受javascript脚本控制的全局对象.window对象通过history对 ...

  4. history.pushState无刷新改变url

    通过history.pushState无刷新改变url 背景 在浏览器中改变地址栏url,将会触发页面资源的重新加载,这使得我们可以在不同的页面间进行跳转,得以浏览不同的内容.但随着单页应用的增多,越 ...

  5. HTML5无刷新修改URL

    HTML5新添加了两个api分别是pushState和replaceState,DOM中的window对象通过window.history方法提供了对浏览器历史记录的读取,可以在用户的访问记录中前进和 ...

  6. HTML5新api即pushState和replaceState实现无刷新修改url

    1,首先我面临一个需求,页面回退时需要知道来之前的页面状态.很简单,回退时在url里赋参数即可.问题是在ipad上,回退按钮是安卓那边的,我控制不了.只好采用js无刷新修改url历史记录,来告诉服务器 ...

  7. HTML5实现无刷新修改URL

    前言 今天在做一个vue的搜索功能,需要从搜索结果页面跳转到细节页面,然后点击返回还能返回到刚刚的结果页面,如果只用window.history.go(-1)当然会重新刷新搜索页面,当然是不行的. 我 ...

  8. php利用iframe实现无刷新文件上传功能

    上传原理很简单就是利用表单的打开方式为iframe的name名,这样就可以在当前页面的iframe打来了,实现文件上传,再利用js返回上传结果. form target .在 action 属性中规定 ...

  9. 利用iframe实现无刷新上传处理

    继上一篇对上传异常进行处理之后,当上传异常的时候的错误体验并不是很好,这里介绍用iframe来进行错误提示 拦截错误 @ExceptionHandler(MaxUploadSizeExceededEx ...

随机推荐

  1. Selenium(十五)cookie

    有时候我们需要验证浏览器中是否存在某个 cookie,因为基于真实的 cookie 的测试是无法通过集成测试完成的.WebDriver 提供了操作 Cookie 的相关方法可以读取.添加和删除 coo ...

  2. springboot2.0整合shiro遇到的问题

    1.重启服务器,访问登陆页面,登陆成功后跳转的不是index,而是favicon.ico

  3. nodeJs修改镜像源

    // 设置 淘宝镜像源npm config set registry https://registry.npm.taobao.org // 查看 使用的 镜像源npm config get regis ...

  4. C# TreeView 右键菜单

    方法一: 在winform中,添加一个contextMenuStrip1,设置TreeView的属性ContextMenuStrip为contextMenuStrip1,并为这个contextMenu ...

  5. sql server 事务和锁的作用

    事务 事务就是作为一个逻辑工作单元的SQL语句,如果任何一个语句操作失败那么整个操作就被失败,以后操作就会回滚到操作前状态,或者是上个节点.为了确保要么执行,要么不执行,就可以使用事务.而锁是实现事务 ...

  6. 071_关闭 SELinux

    #!/bin/bashsed -i '/^SELINUX/s/=.*/=disabled/' /etc/selinux/configsetenforce 0

  7. java大文件上传解决方案

    最近遇见一个需要上传百兆大文件的需求,调研了七牛和腾讯云的切片分段上传功能,因此在此整理前端大文件上传相关功能的实现. 在某些业务中,大文件上传是一个比较重要的交互场景,如上传入库比较大的Excel表 ...

  8. [HNOI2002]营业额统计 II

    https://www.luogu.org/problemnew/show/2234 将权值离散化,以权值为下标建立权值线段树 #include <bits/stdc++.h> using ...

  9. Excel表格内容导出到页面

    引入org.apache.poi.ss.usermodel   public void addExcelBooks() throws Exception { HttpServletRequest re ...

  10. Java基础系列 - 接口(功能,用途和优势)

    package com.test1; /** * 接口的使用 */ public class test1 { public static void main(String[] args) { //创建 ...