如何重定向到另一个页面? [英] how to redirect to another page?

查看:69
本文介绍了如何重定向到另一个页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的 javascript 函数,我想在此事件成功后重定向到另一个页面,我该怎么做?

This is my javascript function and I want to redirect to another page on success of this event so how can I do it?

window.onbeforeunload = function (e) {
    e = e || window.event;

    // For IE and Firefox prior to version 4
    if (e) {
        e.returnValue = 'Sure you want to go back?';
    }

    // For Safari
    return 'Sure you want to go back?';
};

推荐答案

你试过了吗

window.location.href = 'http://redirecttourl.com'

这篇关于如何重定向到另一个页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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