刷新使用window.location.replace或window.open(url,'_ self')打开的页面会将我带到上一个窗口 [英] Refreshing a page opened with window.location.replace or window.open(url,'_self') takes me to previous window

查看:97
本文介绍了刷新使用window.location.replace或window.open(url,'_ self')打开的页面会将我带到上一个窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个已发布的Google网络应用程序,正在用作初始屏幕.当我单击此屏幕上的按钮时,它将正确地带我到页面(使用以下两种方法之一).但是,当我刷新该页面时,它使我返回到初始屏幕,而不是像我希望的那样将我保持在新打开的屏幕上.我以为window.location.replace可以纠正这个问题,但它仍在这样做.

I have a published google web app that I am using as a splash screen. When I click a button on this screen it correctly takes me to the page (using either of the methods below). When I refresh that page, however, it returns me to the splash screen instead of keeping me on the newly opened screen, as I'd like it to do. I thought window.location.replace would correct this, but it is still doing it.

我尝试过window.open(myurl,'_ self')和window.location.replace(myurl)并一直发生.如果我仅使用window.open(myurl)创建一个新选项卡,然后刷新它,它将使我停留在正确的页面上.我希望用户不要打开一堆标签才能正常工作.我有什么需要重新刷新使用window命令打开的页面的东西吗?

I have tried window.open(myurl,'_self') and window.location.replace(myurl) and it keeps happening. If I create a new tab with just window.open(myurl) and I refresh that, it keeps me on the correct page. I would prefer to not have the user open a bunch of tabs for this to work correctly. Is there something I am missing to make this refresh to the page that was opened with the window command?

推荐答案

由于您的应用程序已加载到沙盒iframe中,因此您应该使用

Since your app is loaded in a sandboxed iframe, you should use

window.open(myurl,'_top')

加载到顶部框架

这篇关于刷新使用window.location.replace或window.open(url,'_ self')打开的页面会将我带到上一个窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆