【发布时间】:2019-08-10 07:16:19
【问题描述】:
我的 RestAPI 服务器将用户请求重定向到另一个网页(例如 google.com)我如何将我的前端重定向到该页面,我的意思是我有一个按钮,当我按下它时会向我的服务器。我的服务器将其重定向到另一个网页,我想向我的客户显示该网页
我做了一个axios
const url = "https://cors-anywhere.herokuapp.com/http://147.13.121.244:4001/redirect"
const client = axios.create({
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic a3p0ZXN5547asdhMnFUdVZN',
}
});
let result = await client.get(url, {}).then((response) => {
return response
}).catch((error) => {
return error
})
【问题讨论】:
-
只从服务器获取url,然后window.location = newUrl
-
是您应用的页面部分还是在其他主机上?
标签: javascript reactjs