Skip to content Skip to sidebar Skip to footer

Hide The Src String Of An Image Tag

For example I have: Now some customers are complaining that there customers can see the comp

Solution 1:

Simple answer: no. Long answer: no. Technical answer: Everything that is displayed by a browser needs to be translated to human readable* text in one way. You can obfuscate server side though.

*) human readable also includes very short names like http://gateway.com/P/N/R.jpg.


Solution 2:

You can use data URIs, but this requires you to download the image, convert to base64 and embed in the page (or CSS).

This increases the payload by about 34%.


An alternative is to use CSS to style the page, embedding the image URLs in the CSS. This tends to not be dynamic (though it can be) and still, anyone who knows a bit about web technologies can still view the CSS and see the URLs. Using images in this way is of course also not semantic and can break your page in unexpected ways, meaning you will need to expand more efforts on making things that should "just work", work.


Solution 3:

You can convert your entire image in base64 code. For this can use a tons of services available out there.

Just an example:

Convert any image into a base64 string


Solution 4:

You can try this piece of code

$('img').filter(function(index){return $(this).attr('src')==='';}).hide();

Solution 5:

Can you use Handler for this. This way you can hide URL and if you want you can send image using base64 also with this or just write byte stream in response.

I think this should work and you can also control image path by just changing one piece of code.

Check this link: http://www.codeproject.com/Articles/34084/Generic-Image-Handler-Using-IHttpHandler

Thanks.


Post a Comment for "Hide The Src String Of An Image Tag"