使用window.location.href.replace +点击按钮

时间:2016-02-17 22:59:38

标签: javascript angularjs

我的按钮无效,我的当前网址被添加到我正在指定的点击通过网址并将其添加到我的按钮。

window.location.href.replace('://m','://www') + "/olat/workflows/olat-main/getting-started.aspx"

将“www.Site/mysite/page1/olat/workflows/olat-main/getting-started.aspx”添加到我的按钮中。

2 个答案:

答案 0 :(得分:0)

您需要将连接结果分配回window.location

window.location = window.location.href.replace('://m','://www') + "/olat/workflows/olat-main/getting-started.aspx";

答案 1 :(得分:0)

使用

解决了问题
window.location.origin.replace('://m','://www') + "/olat/workflows/olat-main/getting-started.aspx"