AngularJS $ window.open('url','_blank')指向currentpath + url而不是url [英] AngularJS $window.open('url', '_blank') directs to currentpath+url instead of url

查看:47
本文介绍了AngularJS $ window.open('url','_blank')指向currentpath + url而不是url的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试打开一个具有特定网址的新标签.

I am trying to open a new tab with a specific url.

当我输入

$window.open('www.example.com', '_blank') 

我确实获得了一个新标签,就像我想要的一样,但是没有去:www.example.com

i do get a new tab, just like i wanted but instead of going to: www.example.com

im定向至: http://localhost:8080/www.example.com

它用我的当前地址来代替我的输入

It concatinates my input with my current address

如何使用输入中确切的网址打开一个新标签页?

How do i open a new tab with exactly the url i put in the input?

谢谢!

推荐答案

您是否尝试了 $ window.open('http://www.example.com','_blank')(那是,添加 http://,这样它就不会被解释为相对URL)?

Did you try $window.open('http://www.example.com', '_blank') (that is, add http:// so it's not interpreted as a relative URL)?

这篇关于AngularJS $ window.open('url','_blank')指向currentpath + url而不是url的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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