JavaScript 重定向在 Facebook 应用内浏览器中不起作用 [英] JavaScript Redirection not working in Facebook in-app browser

查看:39
本文介绍了JavaScript 重定向在 Facebook 应用内浏览器中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在网站上有一个中央网页,可根据特定条件将用户重定向到某个特定页面.重定向逻辑用 JavaScript 编码,使用 window.location.href但是这种重定向在 Facebook In App Browser 中总是失败,它在除 Facebook In-App-Browser 版本 323 之外的所有其他移动浏览器中都能正常工作.

We have a central webpage on site that redirects user to some specific page based certain conditions. The redirect logic is coded in JavaScript, using window.location.href But this redirection always fails in Facebook In App Browser, it works well in all other mobile browsers except the Facebook In-App-Browser version 323.

我尝试了下面列出的所有其他可能的 JavaScript 重定向选项,但似乎都失败了.

I have tried all the other possible JavaScript redirection options listed below but all of them seems to fail.

<html><body><script type='text/javascript'> window.open("http://conv-test.mnetads.com/client-side-second-hop/");</script></body>


<html><body><script type='text/javascript'> eval('window.location.href ="http://conv-test.mnetads.com/client-side-second-hop/"');</script></body>

<html><body><script type='text/javascript'> setTimeout(window.location.href ="http://conv-test.mnetads.com/client-side-second-hop/", 10000);</script></body>


<html><body><script type='text/javascript'> setTimeout(window.onload = function(e){ location.replace("http://conv-test.mnetads.com/client-side-second-hop/"); }, 5000);</script></body>

<html><body><script type='text/javascript'>  window.location ="http://conv-test.mnetads.com/client-side-second-hop/";</script></body></html>
// Sets the new location of the current window.

<html><body><script type='text/javascript'>  window.location.assign("http://conv-test.mnetads.com/client-side-second-hop/");</script></body></html>
// Assigns a new URL to the current window.

<html><body><script type='text/javascript'>  window.location.replace("http://conv-test.mnetads.com/client-side-second-hop/");</script></body></html>
// Replaces the location of the current window with the new one.


<html><body><script type='text/javascript'>  self.location ="http://conv-test.mnetads.com/client-side-second-hop/";</script></body></html>
// Sets the location of the current window itself.

<html><body><script type='text/javascript'>  top.location ="http://conv-test.mnetads.com/client-side-second-hop/";</script></body></html>
// Sets the location of the topmost window of the current window.

<html><body><a href="http://conv-test.mnetads.com/client-side-noreferrer/" id="max">Max</a><script type="text/javascript"> document.getElementById("max").click();</script></body></html>

<html><body><script type='text/javascript'>document.location.href ="http://conv-test.mnetads.com/client-side-second-hop/";</script></body></html>

<http-equiv="refresh" content="0; url='http://conv-test.mnetads.com/client-side-second-hop/'">

推荐答案

这是一个错误.它在即将推出的新版本中得到修复.我已经测试过了.

that's is a bug. And It is fixed in the comming new versions. I tested it already.

这篇关于JavaScript 重定向在 Facebook 应用内浏览器中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆