Skip to content

Instantly share code, notes, and snippets.

@getify
Created August 24, 2011 18:07
Show Gist options
  • Save getify/1168723 to your computer and use it in GitHub Desktop.
Save getify/1168723 to your computer and use it in GitHub Desktop.
maybe one way to serve images only to non-js browsers
RewriteEngine on
RewriteRule ^kitty.jpg /nothing [R=204,L]
<!doctype html>
<html>
<head>
<title>Testing &lt;base> inside &lt;noscript> to suppress image loading for JS users</title>
<style>img,#nojs{display:none}</style>
<noscript>
<base href="http://test.getify.com/test-noscript-base/images/"></base>
<style>img{display:inline;}#nojs{display:block;}#js{display:none;}</style>
</noscript>
</head>
<body>
<h1>Testing &lt;base> inside &lt;noscript> to suppress image loading for JS users</h1>
<p id="nojs">You should see an image of a kitty cat! (toggle on JS to skip image)</p>
<p id="js">You have JS enabled! No image for you! (toggle off JS to see image)</p>
<img src="kitty.jpg" />
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment