<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>hashchange test</title> </head> <body style="background:red;overflow:hidden;"> <script> addEventListener('hashchange', function() { document.body.style.background = 'lime'; }, false); location.hash = Math.random(); </script> </body> </html>