如何从一个URL重定向到另一个URL? [英] How to redirect from one URL to another URL?

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

问题描述

如何使用JavaScript重定向到网页中的另一个URL?

window.location.href =URL2

在页面的JS块或包含文件;假设你真的想在客户端上做到这一点。通常,服务器通过300系列响应发送重定向。


How can I redirect to another URL in a web page using JavaScript?

解决方案

window.location.href = "URL2"

inside a JS block on the page or in an included file; that's assuming you really want to do it on the client. Usually, the server sends the redirect via a 300-series response.

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

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