jQuery在新标签页中打开URL [英] Jquery open url in new tab

查看:429
本文介绍了jQuery在新标签页中打开URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个个人脚本来用另一种语言搜索google,并且我有一个从php脚本传递来的网址.我想使用jquery在新标签页中打开该网址(仅适用于Google chrome).

I'm making a personal script to search google in another language and I've got a url that I've passed from a php script. I want to use jquery to open that url in a new tab (only in google chrome).

我尝试过:

  window.open("http://localhost/123", '_blank');

很遗憾,它会在谷歌浏览器的新窗口中打开,很遗憾,这是唯一轻巧到足以在我的计算机上使用的浏览器.我似乎没有在谷歌搜索上取得任何成功,因此任何建议将不胜感激.

It unfortunately Opens in a new window in google chrome, which is unfortunately the only browser that's light enough to use on my computer. I don't seem to have any success googling it so any advice would be much appreciated.

谢谢 山姆

抱歉,如果您不打算像这样编辑,但是我的新问题是(我可能应该在其他地方问这个问题):

EDITED: Sorry if your not meant to edit like this but my new question is (I should probably ask it somewhere else):

在调用window.open("href","_blank")时,如何编辑Google Chrome配置以打开新标签页而不是窗口?

How to edit google chromes config to open a new tab instead of a window when window.open("href", "_blank") is called?

推荐答案

您不能直接控制它,因为它可以由用户配置.您可以尝试"_newtab",它可能适用于Firefox,但实际上您不应该依赖于打开的新选项卡.用户可能已将其浏览器设置设置为在打开弹出窗口时打开新选项卡,或者它可能显示为弹出窗口.一切都取决于浏览器设置.

You can't directly control this, because it can be configured by the user. You might try "_newtab" which might work for Firefox but really you shouldn't rely on a new tab being opened. The user may have their browser settings set to open a new tab when a popup window is opened or it may show up as a popup. It just all depends on the browser settings.

这篇关于jQuery在新标签页中打开URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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