if (document.location.protocol=='http:'){
document.location.protocol = 'https:';
}
if (document.location.protocol=='http:'){
window.top.location = 'https://YOUR_APPLICATION_PAGE_URL'
}
if (document.location.protocol=='http:'){
var applicationUrl = 'https://facebook.com/example-application';
var canvasURL = 'http://example.com/facebook-canvas';
var currentAppPageUrl = (document.location+'').replace(canvasURL, applicationUrl);
window.top.location = currentAppPageUrl;
}
if (document.location.protocol=='http:'){
var applicationUrl = 'https://facebook.com/example-application';
var canvasURL = location.protocol+'//'+location.host+location.pathname;
var currentAppPageUrl = (document.location+'').replace(canvasURL, applicationUrl);
try {
window.top.location = currentAppPageUrl;
} catch (e) {
}
}