如何在使用window.open时保持当前页面 [英] How to Stay on Current page while using window.open

查看:1212
本文介绍了如何在使用window.open时保持当前页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在触发 Window.open(); 命令。这将在另一个选项卡中打开链接页面。我想要的是当我点击链接时,链接将在新窗口中打开,但应该在同一页面上。

I am firing the Window.open(); command. which opens the link page in another tab. what i want is when i click the link, the link will open in new window but should be on the same page.

这可能吗?

目前我正在使用这样的。

presently i am using like this.

function AddToDatabase(url) {
            window.open(url, "_blank");
}


推荐答案

使用_self而不是_blank。

Use _self instead of _blank.

window.open(url, "_self");




  1. _blank - 将URL加载到新窗口中。这是默认的

  2. _parent - 将URL加载到父框架中

  3. _self - URL替换当前页面

  4. _top - URL替换任何可能加载的框架集名称 - 窗口名称

  1. _blank - URL is loaded into a new window. This is default
  2. _parent - URL is loaded into the parent frame
  3. _self - URL replaces the current page
  4. _top - URL replaces any framesets that may be loaded name - The name of the window

有关详细信息。请参阅此链接

For further details. See This Link

这篇关于如何在使用window.open时保持当前页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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