为什么 window.location.href= 不使用 Safari 转发到页面? [英] Why isnt window.location.href= not forwarding to page using Safari?

查看:30
本文介绍了为什么 window.location.href= 不使用 Safari 转发到页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网站允许用户通过 Fb 按钮登录,我为此使用 FB/Parse.com JDK https://parse.com/docs/js/guide#users-facebook-users

My site lets users login via the Fb button, I'm using the FB / Parse.com JDK for this https://parse.com/docs/js/guide#users-facebook-users

一旦用户被识别,下面的代码就会让用户登录并将他们转发到一个 url.这在 Chrome 下按预期工作,但在使用 Safari 时不起作用,页面只停留在空白的 fb.html 页面上

Once the user has been identified, the below code logs the user in and forwards them onto a url. This works as expected under Chrome, but will not work using Safari, the page just stays on the fb.html page which is blank

我发现

window.location.href=

window.location.href=

但是,找不到适合我的解决方案的修复程序.有没有人知道解决这个问题的方法?

But, can't find a fix that works for my solution. Does anyone know a way around this?

Parse.FacebookUtils.logIn(null, {
    success: function(user) {
        if (!user.existed()) {

        } else {
            window.location.href="user_home.html";

        }
    },
    error: function(user, error) {

    }
});

推荐答案

在所有浏览器中工作的最佳方式:

Best way work in all browsers:

setTimeout(function(){document.location.href = "user_home.html";},250);

这篇关于为什么 window.location.href= 不使用 Safari 转发到页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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