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. redis-4.0.14 cluster 配置实战

    1.操作系统配置 切换到root用户修改配置sysctl.conf vim /etc/sysctl.conf # 添加配置: vm.max_map_count= vm.overcommit_memor ...

  2. celery 笔记

    参考:https://blog.csdn.net/tichimi3375/article/details/82415412 中文翻译:https://www.celerycn.io/      htt ...

  3. vue 传入一个对象的所有属性

  4. AtCoder NIKKEI Programming Contest 2019 E. Weights on Vertices and Edges (并查集)

    题目链接:https://atcoder.jp/contests/nikkei2019-qual/tasks/nikkei2019_qual_e 题意:给出一个 n 个点 m 条边的无向图,每个点和每 ...

  5. 40 | insert语句的锁为什么这么多?

    在上一篇文章中,我提到 MySQL 对自增主键锁做了优化,尽量在申请到自增 id 以后,就释放自增锁. 因此,insert 语句是一个很轻量的操作.不过,这个结论对于“普通的 insert 语句”才有 ...

  6. 16 | “order by”是怎么工作的?

    在你开发应用的时候,一定会经常碰到需要根据指定的字段排序来显示结果的需求.还是以我们前面举例用过的市民表为例,假设你要查询城市是“杭州”的所有人名字,并且按照姓名排序返回前1000个人的姓名.年龄. ...

  7. kubectl 日常命令 备忘

    目录 kubectl 常用命令 自动补全 Kubectl命令概览 常用命令分类 常用命令 声明式资源对象管理 查看资源状态 容器管理 集群管理 常用命令英文缩写 kubectl 常用命令 自动补全 使 ...

  8. ROS手动编写消息发布器和订阅器topic demo(C++)

    1.首先创建 package cd ~/catkin_ws/src catkin_create_pkg topic_demo roscpp rospy std_msgs 2. 编写 msg 文件 cd ...

  9. git 常用命令使用,git bash通用命令

    git 常用命令 1.强制推送(慎用,除非你认为其他冲突等可以丢弃 或者不是很重要) git push -- force 2.创建文件等小命令 touch a // 创建一个a文件 >> ...

  10. python传参数是传值还是传址?

    传址 不可变类型(数值型.字符串.元组): 因变量不能修改,所以运算不会影响到变量自身 可变类型(列表字典):函数体运算可能会更改传入的参数变量.