JavaScript 重定向在 Facebook 应用内浏览器中不起作用

标签 javascript redirect inappbrowser facebook-browser

我们在站点上有一个中央网页,可以根据某些条件将用户重定向到某个特定页面。
重定向逻辑用 JavaScript 编码,使用 window.location.href
但是这种重定向在 Facebook In App Browser 中总是失败,它在除 Facebook In-App-Browser 版本 323 之外的所有其他移动浏览器中都运行良好。
我已经尝试了下面列出的所有其他可能的 JavaScript 重定向选项,但它们似乎都失败了。

<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/'">

最佳答案

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

关于JavaScript 重定向在 Facebook 应用内浏览器中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68101925/

相关文章:

ssl - Nginx 服务器 : Redirecting www, ip 和非 ssl

javascript - ionic 应用浏览器 : Custom Events

ios - 手机间隙 : External links not opening in Safari on iOS 9

ios - inappbrowser 在 iOS 上无法正常工作

javascript - 解析文本以格式化内容中的 URL 并缩短 URL

javascript - firebase 数据库调用的数组记录了正确的数据,但长度显示为 0

javascript - Element.getElementsByTagName 的问题

javascript - 如何更改CKEditor的编辑器大小?

redirect - NGINX - 返回 301 与重写

php - 如何使用 .htaccess 从非安全版本的站点重定向到安全版本的站点