【日常】纪录一个愚蠢的问题

最近在做JSP的课设,摸鱼划水了好多天,今天开始改项目。
然而当我去实现一个JS实现跳转问题的时候,我的Chrome开始猛给我报错

mymenu.js:160 Unsafe JavaScript attempt to initiate navigation for frame with origin 'http://unspoken:8080' from frame with URL 'http://localhost:8080/ShoppingDay01/LeftController/queryOne'. The frame attempting navigation is neither same-origin with the target, nor is it the target's parent or opener.

Uncaught DOMException: Failed to set the 'href' property on 'Location': The current window does not have permission to navigate the target frame to 'http://localhost:8080/ShoppingDay01/jsps/book/list.jsp?cid=A9CFBED0F77746C5BD751F2502FAB2CD'.
    at skip (http://localhost:8080/ShoppingDay01/menu/mymenu.js:162:34)
    at HTMLDivElement.onclick (http://localhost:8080/ShoppingDay01/LeftController/queryOne:1:1)
skip @ mymenu.js:162
onclick @ queryOne:1

我花了长达一个半小时的时间来调试这个Bug,中途由于过于烦躁还出去买了一趟零食(借口),果然在外面透了透气,回来大脑清醒多了,开始重新调试Bug。
果不其然,这个bug的原因是我在MyEclipse内置Browser的地址栏复制url时,我复制出来的url是:

http://unspoken:8080

如图
在这里插入图片描述
所以复制到浏览器时,当我去跳转到一个 http://localhost:8080 的url时肯定会出现跨域问题,所以只要把外置Browser的url也改成 http://localhost:8080 就好啦
在这里插入图片描述

你可能感兴趣的:(日常QvQ)