window.open()只是将url添加到我当前的url [英] window.open() simply adds the url to my current url
问题描述
当我使用window.open(www.google.com,_ blank);
When I use window.open("www.google.com", "_blank");
window.open("www.google.com", "_blank");
新标签页已打开,但网址不是www.google.com,而是= url-i-was-at = / www.google.com。
A new tab is opened, but the url isn't "www.google.com", it's "=url-i-was-at=/www.google.com".
这是代码片段(以及唯一相关的代码)。
http://jsfiddle.net/FUYTY/
This is a snippet of the code (and the only relevant code). http://jsfiddle.net/FUYTY/
在jsfiddle中它的行为有点不同,但仍然无法正常工作。
In jsfiddle it behaves a bit differently, but still doesn't work as it should.
我做错了什么?
推荐答案
您想访问服务器 www.google.com
的根文档,已完成使用网址 http://www.google.com/
。您提供了文档 www.google.com
的相对网址。
You wanted to access the root document of server www.google.com
, which is done using the url http://www.google.com/
. You provided a relative url for document www.google.com
instead.
这篇关于window.open()只是将url添加到我当前的url的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!