1

I have an <a> tag on the page like below:

<a href="/-/media/Wallpapers/wallpaper_nokia.jpg" download="">Download Wallpaper</a>

When the user clicks on the link the save as button opens up for the user to save the image. What I want to do is to redirect user to the home page after user clicks on the save button.

Is there any way to achieve this in javascript?

R3tep
  • 11,845
  • 10
  • 43
  • 71
Milad
  • 522
  • 1
  • 3
  • 18

1 Answers1

0

Yes there is:

// similar behavior as an HTTP redirect
window.location.replace("http://stackoverflow.com");

// similar behavior as clicking on a link
window.location.href = "http://stackoverflow.com";
Korovjov
  • 463
  • 5
  • 14