Javascript 重定向Ajax后获取url
要在Instagram上进行身份验证,我需要获取Instagram发送给我的url作为重定向。我需要得到重定向的url,但我得到了一个空值Javascript 重定向Ajax后获取url,javascript,ajax,api,instagram,Javascript,Ajax,Api,Instagram,要在Instagram上进行身份验证,我需要获取Instagram发送给我的url作为重定向。我需要得到重定向的url,但我得到了一个空值 $.ajax({ url: "https://instagram.com/oauth/authorize/?client_id=e40f15a90**c89851d8a66&redirect_uri=http://examle.com&response_type=token", success:function(result,status,
$.ajax({
url: "https://instagram.com/oauth/authorize/?client_id=e40f15a90**c89851d8a66&redirect_uri=http://examle.com&response_type=token",
success:function(result,status,xhr){
console.log(xhr.getResponseHeader('Location'));<---NULL
}
});
$.ajax({
url:“https://instagram.com/oauth/authorize/?client_id=e40f15a90**c89851d8a66&重定向uri=http://examle.com&response_type=token",
成功:功能(结果、状态、xhr){
console.log(xhr.getResponseHeader('Location'));在请求导致重定向后,无法获取头信息。标准方法是使用auth url(“”)打开新的子窗口,
)并在重定向url中检索令牌,例如在onready事件中http://examle.com
之后,将令牌发送到父窗口并关闭弹出窗口(子窗口)
推荐Instagram AUTH是服务器端,所以考虑使用它。
我不认为这是可能通过Ajax——因为这是一个请求在后台,浏览器将遵循自动重定向。因此,当控件返回到您的脚本时,不再有<代码>位置< /代码>标题。问题是我是MA。一个移动应用程序的王,我没有服务器。我必须考虑哪个URL作为重定向URL?@ PoChePtSOV