我正在使用一个应用程序(“http://apps.facebook.com/greetingz”),这是我使用的 ajax 部分,我可以发送一个请求,并且接收者也可以接收通知,但是当接收者点击通知时,它会直接转到画布页面“apps.facebook.com/greetingz”,实际上我想显示一个不同的页面..请帮忙!
<?php
$app_id = "127736900693315";
$canvas_page = "http://apps.facebook.com/greetingz";
$message = $_POST['varx'];
$requests_url = "https://www.facebook.com/dialog/apprequests?app_id="
. $app_id . "&redirect_uri=" . urlencode($canvas_page)
. "&message=" . $message;
if (empty($_REQUEST["request_ids"])) {
echo("<script> top.location.href='" . $requests_url . "'</script>");
} else {
// echo "Request Ids: ";
//print_r($_REQUEST["request_ids"]);
echo $message;
}
?>
我如何在这个应用程序中使用下面的代码
function onUrl(data) {
if (data.path.indexOf("games.achieves") != -1) {
console.log('I will process some achievement now.');
} else if (data.path.indexOf("request_ids") != -1) {
console.log('I will process some request now.');
} else {
// default behaviour
window.location = data.path;
}
}
FB.Canvas.setUrlHandler(onUrl);