Javascript jquery获取重定向url

Javascript jquery获取重定向url,javascript,jquery,facebook,mobile,jquery-mobile,Javascript,Jquery,Facebook,Mobile,Jquery Mobile,编辑- 没有得到回应,所以让我问一下。我能做这个吗 <a href="http://m.facebook.com/...." target="_webapp">facebook button</a> 如果您使用的是jQuery Mobile,请查看pagebeforeshow事件 您还可以尝试在mobileinit事件的处理程序中添加注册ajaxComplete处理程序 1.它与jQuery移动框架有什么关系?2.如果我理解正确的话,你就不能。您可以使用jquery

编辑- 没有得到回应,所以让我问一下。我能做这个吗

<a href="http://m.facebook.com/...." target="_webapp">facebook button</a>

如果您使用的是jQuery Mobile,请查看pagebeforeshow事件

您还可以尝试在mobileinit事件的处理程序中添加注册ajaxComplete处理程序


1.它与jQuery移动框架有什么关系?2.如果我理解正确的话,你就不能。您可以使用jquery mobile和rhomobile将
绑定到
上,单击
a
上的
并阅读其
href
。希望本机应用程序与jqm的工作方式类似,在实际进入页面之前读取重定向的url。在第166行左右设置方案或fbauth://authorize 在第279行,它查找url是否以这个开头,并解析令牌或错误。我拒绝加入facebook,所以我不知道如何使用它,更不用说为它编码了。除非你根据现有的标准(比如HTTP重定向?什么重定向?)以及如何/何时发生,准确地定义你所说的
重定向
是什么意思,否则我无法帮你解决facebook的问题
CALLBACK_URL = fb(YOUR_APP_ID)://authorize/
url = "https://m.facebook.com/dialog/oauth?client_id=YOUR_APP_ID&redirect_uri=CALLBACK_URL"
WebView.navigate(url)
WebView.execture_js('$(document).ready(function() {
    $("body").ajaxComplete(function(e, xhr, settings) {
        if (xhr.getResponseHeader("Location").hostname == "fb(YOUR_APP_ID)://authorize/"){
            alert(xhr.getResponseHeader("Location"));
            // and redirect back to action in my app...
        }
    });
});')
$('div').live('beforepageshow', function(event, ui) {
    var page = $(this).attr("id");
    if (page == 'mypage') {
        // your logic here
    }
});
$(document).bind("mobileinit", function() {
  $("body").ajaxComplete(function(e, xhr, settings) {
       if (xhr.getResponseHeader("Location").hostname == "fb(YOUR_APP_ID)://authorize/"){
            alert(xhr.getResponseHeader("Location"));
            // and redirect back to action in my app...
        }
  });
});