态度决定一切

0%

chrome模拟跨域访问

  1. 首先随便打开一个网站

  2. 打开 console
    输入

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

var data = {
password: "xxx",
userName: "xxx"
};
var xhr = new XMLHttpRequest();
xhr.open('post', 'http://127.0.0.1:8080/console/login');
xhr.setRequestHeader("Content-type","application/json");
xhr.setRequestHeader("SESSION_TOKEN","112233");
xhr.setRequestHeader("CONSOLE_SESSION_TOKEN","112233");


xhr.send(JSON.stringify(data));
xhr.onload = function(e) {
var xhr = e.target;
console.log(xhr.responseText);
}
  1. 修改域名、参数、header等信息即可