首页
学习
活动
专区
圈层
工具
发布
  • 您找到你想要的搜索结果了吗?
    是的
    没有找到

    window.opener.location 安全风险讨论

    在浏览器中,通过 标签或者 JavaScript 中的 window.open 函数,可以打开新页面。新页面的 window 对象中,存在一个 opener 属性,保存对父页面的引用。...但是,在子页面访问 opener.location 的一些属性和方法时却不受 SOP 保护,这就是本文要探讨问题的核心所在。...http://qgy18.imququ.com/file/opener.html" target="_blank">click me 子页面中有这样一段代码: HTML window.opener.location...= 'https://imququ.com/post/about.html'; //window.opener.location.replace('https://imququ.com/post...这个问题可以通过在页面增加 var location; 来解决,不属于本文重点,这里不展开讨论) 由表格可以看出,在所有现代浏览器中,默认情况下父页面都会被跳走。

    2K60

    window.location对象实现页面刷新

    用户点击浏览器后退按钮后页面ajax没有更新,通过使用windowlocation对象的方法属性实现页面刷新并刷新数据 window.location.reload() 该方法使浏览器刷新当前页面。...解决办法: 使用location.href代替reload()来进行页面刷新或者跳转。 window.location.href = location.href+'?...time='+((new Date()).getTime()); location.href location.href是最常用的属性,用于获得或设置窗口的URL,类似于document.url属性。...window.location.href = window.location.href; // 这样也可以实现页面刷新并提交数据,数据提交时无弹窗提示 location.replace() 该方法通过指定...使用location.href属性跳转会被加入到浏览器的历史栈中,这意味着可以通过后退键来撤退。

    2.7K40

    JavaScript中window.open()和Window Location href的区别

    1:window.location.href的用法: self.location.href;//当前页面打开URL页面 window.location.href;//当前页面打开URL页面 this.location.href...3: window.open和window.location.href的区别 1:区别 window.location是window对象的属性,而window.open是window对象的方法 window.location...:在框架内指定页面打开连接 window.location或window.open如何指定target?...这是一个经常遇到的问题,特别是在用frame框架的时候 解决办法: window.location 改为 top.location 即可在顶部链接到指定页 或 window.open("你的网址...11:打开新页面 用window.open()打开新页面 但是用window.location.href="" 却是在原窗口打开的. 有时浏览器会一些安全设置window.open肯定被屏蔽。

    3.3K51

    JavaScript中window.open()和Window Location href的区别「建议收藏」

    目录 1:window.location.href的用法: 2:window.open()的用法 3: window.open和window.location.href的区别 1:区别 2.window.open...10:【在弹出窗口中加上一个关闭按钮】 11:打开新页面 ---- 1:window.location.href的用法: self.location.href;//当前页面打开URL页面 window.location.href...3: window.open和window.location.href的区别 1:区别 window.location是window对象的属性,而window.open是window对象的方法 window.location...:在框架内指定页面打开连接 window.location或window.open如何指定target?...这是一个经常遇到的问题,特别是在用frame框架的时候 解决办法: window.location 改为 top.location 即可在顶部链接到指定页 或 window.open(“

    8.9K20
    领券