如果 JavaScript 被禁用,如何重定向? [英] How to redirect if javaScript is disabled?

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

问题描述

我有一个严重依赖 javaScript 的网站.我创建了一个镜像站点,其中包含所有 JS 以及所有需要删除 JS 的元素.如果用户没有启用 javaScript,有什么好的、简单的方法可以将用户重定向到镜像站点?

I have a site which relies heavily on javaScript. I created a mirror site, which has all the JS as well as all the elements that require JS removed. What is a good, easy way to redirect users to the mirror site if they don't have javaScript enabled?

我试过了,但似乎不太好:

I tried this, but it doesn't seem very good:

<noscript>
  <meta http-equiv="refresh" content="0; URL=nojs/index.php">
</noscript>

我也尝试将 header-redirect 放入 noscript 标签中,但这没有用.

I also tried to putting header-redirect into the noscript tag, but that didn't work.

推荐答案

将站点的非 JavaScript 版本设为默认版本.在其中包含一个小脚本以重定向到脚本站点.

Make the no-JavaScript version of the site the default. Include a small script in there to redirect to the scripted site.

或者,完全放弃使用重定向并使用渐进增强

Or, abandon the use of a redirect entirely and go with Progressive Enhancement

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

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