主要代码:<meta http-equiv="Access-Control-Allow-Origin" content="*">

说明一下什么情况下我们用到这个标签:如果chrome浏览器报

XMLHttpRequest cannot load http://google.com/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://run.jsbin.io' is therefore not allowed access.
在html页面加入:
<meta http-equiv="Access-Control-Allow-Origin" content="*">
在java代码中加入跨域:
controller类中加入
response.setHeader("Access-Control-Allow-Origin", "*");


05-11 22:34