Take Back Content Scraped and Stolen by Content Thieves
Content scrapers run by content thieves grab the source code of web pages. The thieves then publish the stolen content on their own websites.
Content delivered with a script, iframe, or object tag can have a theft check built in. If the content is delivered to an unauthorized domain, alternative content can be delivered.
The alternative content may be, as examples, an ad, a warning to the visitor on the thief's website that the content they are viewing has been stolen, or cause the browser to redirect to, or load the page at, another URL.
This JavaScript will check to see if the domain in the referring URL is the authorized domain. If not, it reloads the page with the URL of your choice.
<script type="text/javascript"> // Customization. ///////// // Replace "willmaster.com" with the authorized domain name (do not include the "www." part). var authdomain = "willmaster.com"; // Replace "http://blogsjustin.com" with the URL to redirect the browser to if unauthorized referrer. var newURL = "http://blogsjustin.com"; // End customization. ///////// if( document.referrer && document.referrer.length ) { var re = new RegExp("//(www\.)?"+authdomain,"i"); if( ! re.test(document.referrer) ) { top.location.href = newURL; } } </script>
The two customizations in the above script are to specify the authorized domain name and the URL of the page to load if the referrer is unauthorized. When specifying the domain name, do not specify a leading "www.", but if it is a different subdomain then do specify the subdomain.
If the within an iframe or object tag is a PHP web page, PHP can be used to deliver alternative content. It can be done like this:
<?php // Customization. ///////// // Replace "willmaster.com" with the authorized domain name (do not include the "www." part). $authdomain = "willmaster.com"; // End customization. ///////// ?> <?php if( isset($_SERVER['HTTP_REFERER']) and preg_match("!//(www\.)?$authdomain!i",$_SERVER['HTTP_REFERER']) ): ?> [AUTHORIZED CONTENT HERE] <?php else: ?> [ALTERNATE CONTENT HERE] <?php endif; ?>
In the above script, specify the authorized domain name. When specifying the domain name, do not specify a leading "www.", but if it is a different subdomain then do specify the subdomain.
Will Bontrager