Forum Thread: Hey, I Was Wondering if It Is Possible to Make an Image Automatically Redirect to Specific URL on Android?

For instance upon download, it automatically redirects to a specific URL or clicked,Like When Someone Receives and Clicks It on Whatsapp. A Tutorial Would Be Greatly Appreciated :)

6 Responses

This can easily be done with some simple javascript:

<img src="image source here" onclick=window.location.assign("destination here")></img>

Good to note that this does not just work on android devices, but on anything that supports javascript.


Bless you for that! ..but I'm a beginner, could you please show me in (noob friendly) steps of how to accomplish this?

In your question you mentioned whatsapp, so here's the code that would take a whatsapp picture, and when clicked redirect you to nullbyte:

<img src=" " onclick=window.location.assign(" ")></img>_

An easy way to test code is to try is to use W3 School's TryitEditor. All you need to do is copy and paste the code between the html tags (<html></html>). You can try sending it by email but it probably won't work since javascript is usually stripped off the image at the receiving end as to prevent malicious attacks. Xss would probably be used in a real world situation (to get the code onto a server) with onload instead of onclick(that way the victim doesn't even have to click the link, they just need to visit a page with our picture on it). Another option would be to host the image yourself.

Ignore the extra spaces.

Thanks again for that!

Share Your Thoughts

  • Hot
  • Active