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

查看:115
本文介绍了如果禁用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天全站免登陆