This script will redirect the user from http://www.yourdomain.com/path?key=value or http://apps.facebook.com/canvasname/path?key=value to http://www.facbeook.com/page_url?args&app_data=location|path%3Fkey%3Dvalue
It will disable the redirect on mobile or iPhone/iPad app. By being executed as inline script and hiding the body content the redirect will happen very fast and prevent broken images.