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 :)

5 Responses

This can easily be done with some simple javascript:

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

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="https://lh3.ggpht.com/bwBj9B4fGmTN_of0JS8xdkwklCmqCzSne1tJ9RaUNRQIzU-FEyCuFWzlsLyyPoTbyJE=w300 " onclick=window.location.assign("https://null-byte.wonderhowto.com ")></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