I am making a web site and I was wondering how I would redirect the user to a different website if Javascript is not enabled. I can't use <noscript> because It needs to redirect. Could I put a meta tag inside a noscript tag? Thx.

Recommended Answers

All 2 Replies

Please find below a meta tag for re-direction,

<meta http-equiv="refresh" content="2; url=http://www.somedomain.com.com/" />

In content attribute you will have to pass two values:
1: time in seconds.
2: the target url.

However I am not sure about browser/platform compatibility of this script.

But hopes this works for you... Good Luck!

The only way I can think to do it would be to have it redirect if they DO have javascript, else they see the regular noscript page. Like so...

<script type="text/javascript">
window.onload = function {
location.href='http://thejavascriptversion.com/page';
return true;
}
</script>

That way if they don't have javascript they never get redirected...
But if they do...wha la!! Off to the js version of your site.

But there's no way to check (client side) if they don't have js, without using...javascript!!

The above plan should get around that though.

good luck!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.