Life is Beautiful. Don't ruin it with your thoughts.
Showing posts with label html. Show all posts
Showing posts with label html. Show all posts

Saturday, June 21, 2014

How to protect images from theft and hot linking from your website

Now I have recently been looking for a nice trick on hiding the image url, or source that I have put up on a page. Everyone who works online and posts their image/photo on their website or blog, are scared of the thought that their work may get stolen or get hot linked by anyone. Unfortunately there was no good way to do that (until now) and I decided to come for the rescue of other people like me.

In the following tutorial 'm gonna show how to completely protect a image in-spite of displaying the image into the webpage.

First create a .css file and paste the following code in it and save it:

#fp h1 a{background:url('/image.png') no-repeat;height:208px;width:155px;display:block;outline:none !important;}
#fp h1 a span{visibility:hidden;}


In the above code, change the "/image.png" with the location and name of your own image.
(For noobs) You can alter the height and width of the image by changing the variable in the 'height' and 'width' part of the second line.
I've named my .css file as style.css

Now at the <head> section of your webpage, where your image has to be displayed, we'll link our .css file we just created above, like this:

<link rel="stylesheet" href="/style.css">

Now finally we'll do the coding for displaying the image by Creating a <div> section at the place where you wanna display your image, the whole code may look something like as follows:

<div id="fp">
<h1><a href="/page" title="Some Title"><span>Some Text</span></a></h1>
</div>

Done.

Ofcourse you may dig around the above code and change it as your liking.

Now remember: There are soo many different ways to steal a image from a website, I've just shown to eliminate one (which is one of the most common way of stealing), That doesn't mean that its 100% safe. The above trick will repel all the noobs and newbies, or basically anyone whos not good with computers from copying, linking or downloading your image.






Thursday, May 19, 2011

How to create a fake link!

Have you ever wondered of creating a fake url/hyper link? A link which shows a particular destination on mouse-hover (URL in the status bar of the browser), but takes you to another page/url on clicking on it. Then you have came to the right place.... Here is the trick/code by which you can create a fake link by using javascript element, it is supported by almost all major web browsers and is very tiny:

<a href="http://google.com" onclick="window.open('http://www.youtube.com'); return false;">Fake Link</a>

If you want the link to open in same window/tab, then replace "window.open"  (without quotes) with "location.replace" (without quotes) something like this:

<a href="http://google.com" onclick="location.replace('http://www.youtube.com'); return false;">Fake Link</a>

The above code will create a link, which will show the destination url google.com on mouse-hover in the status bar, but will take you to youtube.com on clicking on it. It should look something link this:  Fake Link. But the demerit of this is, it will work only if javascript is turned on/enabled in the visitor's web browser, otherwise the link will open the same url as it shows in the mouse-hover, as in this case it will open google.com if the javascript is disabled in the browser.... But thats not a very big deal, because all browsers have javascript enabled as default, and nowadays javascript is so important that, everyone keep it on always.... And one notable thing is anyone who is known to a little html can figure out the smartness we have done with the link, if IN CASE he/she happens to view the source of the page of the fake link, unless you have encrypted the source of your page.

Another thing to note in here is, when the user once clicked in this link, and visited an undesired location, he/she would not be able to go back in the previous page.

so go on, do some hacking.....

Regards
S.K







Follow / Like / Subscribe My Social Accounts By Clicking on The Buttons Below:
Back to top