Block page when javascript was deactivated.

lan_gallery

Joined: 2010-08-23
Posts: 4
Posted: Fri, 2011-03-11 16:59

Hi,i´m working on a site where they shows and sell their photos, so it is important that visitors can´t download pictures, the problem is when they deactivate javascript all the pictures on the web can be download.I would like to know in which module is the validation to know if javascript is activated or not. I need to modify and "block" the visitors to navigate the web (put the page in blank or something) if javascript is deactivated.
Thanks for your help.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Fri, 2011-03-11 17:28

you could always do something simple like set all images on the page to display: none;
Then if the visitor has javascript set them back to display: block;

<script type="text/javascript">
    document.getElementsByTagName("img").style.display = 'block';
</script>

this way only visitors w/ javascript can see any images on yoursite.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
Dayo

Joined: 2005-11-04
Posts: 1642
Posted: Sat, 2011-03-12 09:21

In addition, rather than just serve them a blank page, you can pass visitors with javascript disabled a message by creating a noscript.tpl file in the templates folder of your theme with something like the following in it...

<noscript>
<h2>Please enable javascript in your browser settings to enable image display</h2>
Thank you for visiting xyz.com
</noscript>

Then include it in photo.tpl (to only show in photo pages) or theme.tpl (to show on all pages)

{g->theme include="noscript.tpl"}

--
dakanji.com

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Sat, 2011-03-12 23:14

These will be the same visitors who can just dig the files out of their browser's cache, or work out the url structure, or just use the PrtSc button and Paint to take a screen grab of the pictures they're not allowed to download?