Javascript 可以打开带有标题的网页吗?

Javascript 可以打开带有标题的网页吗?,javascript,reactjs,header,authorization,window.open,Javascript,Reactjs,Header,Authorization,Window.open,可以打开带有标题的网页吗 我需要能够在头中传递JWT,而不是查询参数 查询参数可以保存到日志中,这是一种安全风险 我知道用window.open()打开带有标题的网页是不可能的,但是用Vanilla Javascript可以吗 如果是,那怎么办 我正在使用React来构建这个概念证明。不可能使用window.open()发送标题,也不可能使用标题打开新页面,但是使用一个页面内的javascript可以: 获取的示例: fetch(url, { method: 'POST', // *G

可以打开带有标题的网页吗

我需要能够在头中传递JWT,而不是查询参数

查询参数可以保存到日志中,这是一种安全风险

我知道用window.open()打开带有标题的网页是不可能的,但是用Vanilla Javascript可以吗

如果是,那怎么办


我正在使用React来构建这个概念证明。

不可能使用
window.open()发送标题,也不可能使用标题打开新页面,但是使用一个页面内的javascript可以:

获取的示例:

 fetch(url, {
    method: 'POST', // *GET, POST, PUT, DELETE, etc.
    headers: {
      'Content-Type': 'application/json'
      // 'Content-Type': 'application/x-www-form-urlencoded',
    },
    body: JSON.stringify(data) // body data type must match "Content-Type" header
  });
}
XMLHttpRequest的示例:

var xhr = new XMLHttpRequest();
xhr.open("POST", '/server', true);

//Send the proper header information along with the request
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

xhr.onreadystatechange = function() { // Call a function when the state changes.
    if (this.readyState === XMLHttpRequest.DONE && this.status === 200) {
        // Request finished. Do processing here.
    }
}
xhr.send("foo=bar&lorem=ipsum");