Last active
January 17, 2018 14:07
-
-
Save brendanc/19240f1c7ae44782e5024365084c4f4a to your computer and use it in GitHub Desktop.
redirect to random image
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <script type="text/javascript"> | |
| function redirect() { | |
| var random = Math.floor(Math.random() * Math.floor(5)) + 1; // random number between 1 and 5 | |
| var number = random*100; // just make this bigger for this example only so placeholder image is reasonable | |
| var image = "http://via.placeholder.com/" + number + ".png"; | |
| window.location.replace(image); | |
| } | |
| window.onload = redirect; | |
| </script> | |
| </head> | |
| <!-- in case javascript is disabled or something else goes wrong, just redirect to this image --> | |
| <meta http-equiv="refresh" content="2;url=http://via.placeholder.com/300.png"> | |
| <body></body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment