Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hidden img src value

Tags:

html

css

So I'm not sure if this is even possible as I couldn't find anything by searching however I would like confirmation.

Is it possible to to hide the src value of the img tag? For example: <img src="image.jpg" /> would appear as <img src="" /> or some other sort of method. Even if the user right clicks to get the image url, I don't want it being retrieved. Is this at all possible?

I don't have access to the head element, nor can I use Javascript or PHP. I can only use limited HTML tags that are accepted by Markdown.

like image 643
Spedwards Avatar asked Dec 01 '22 16:12

Spedwards


2 Answers

No its not possible to hide it through js/jquery or any scripting language. Though there are tweaks etc like you can disable right click or showing fake image src or setting image using CSS background-image property (this way, the user won't be able to right click and save the image as) to deceive a common user;

<body oncontextmenu="return false">
</body>

What i understand, your wish is to restrict users from stealing your images by hiding the image source. Remember, if a user can see the image on their browser, then it means the user has downloaded the image and it is already on their computer. Simple is that. There is no way to prevent images from being stolen.

Even if you managed to somehow invent a way for an image to be shown on the customers computer without them downloading it, then they can still take a screen shot, and again your plans have been failed.

Some helping links for you (questions like yours)

1) Protect image download 2) Restricting images from direct url download

like image 152
Aamir Shahzad Avatar answered Dec 18 '22 14:12

Aamir Shahzad


I imagine that this would not be possible since altering the src with JavaScript would change the image itself. In addition, even if you were somehow hide the src from the user, it could easily be retrieved by...

  • Right clicking on the image and pressing the Copy image URL option, making it that much harder to prevent the user from viewing the source of the image
  • Doing the same and pressing Save image as....

The best you could do would probably be to disable right clicking, but that would stop almost nobody if they really wanted to figure it out. There are most likely even more ways, but, in short, I would say that it is not possible.

like image 35
Anonymous Avatar answered Dec 18 '22 14:12

Anonymous