FB App Messenger浏览器问题:如何关闭弹出窗口并重定向父窗口

时间:2018-10-09 12:07:13

标签: javascript php ios facebook popupwindow

为什么此代码在FB App Messenger浏览器(Webview)中不起作用。 父窗口:

<html>
<head>

    <script language="Javascript">

        function showFBWindow(){
            url = "allowfbchild.html"
            newwindow=window.open(url,'name','height=200,width=150');
            if (window.focus) {newwindow.focus()}
        }

    </script>

</head>
<body>

    <input type="button" OnClick="showFBWindow()" value="Open FB" />

</body>
</html>

子窗口(allowfbchild.html):

<html>
<head>

    <script language="Javascript">

        function redirectToFB(){
            window.opener.location.href="http://wwww.facebook.com";
            self.close();
        }

    </script>

</head>
<body>

    Allow the user to view FB
    <br/>Are you sure?
    <input type="button" value="Ok" OnClick="redirectToFB()" />

</body>
</html>

当单击redirectToFB()按钮时。它不能按编码工作。

0 个答案:

没有答案