我正在尝试使用window.location.assign
来更改我的项目页面,但它无效。
我想要更改的页面位于同一文件夹中。
我的代码:
filterFunc (){
window.location.assign("/teste");
}
无法加载https://console.bluemix.net/analytics/bmaid:请求的资源上没有“Access-Control-Allow-Origin”标头。因此,不允许原点“http://localhost:3000”访问。
index.js:2178 +++ DBDM-ERROR> getAnonymousID> Ajax调用错误。 (执行时间:309ms):
在IDE中,它不会出错,仅在单击按钮后的页面上。
如果有人知道该怎么做?单击按钮切换页面!
答案 0 :(得分:0)
location.assign工作你应该使用正确的方法只需要改变一件事
window.location.assign("/teste");
应该是
window.location.assign("http://localhost:3000/teste");
这也是w3schools的方式。但令我伤心的是你正走在正确的道路上。
注意:最佳做法是使用window.location,大多数浏览器都支持此功能,例如:window.location = 'http://google.com'