location=location

July 26th, 2008. Tagged: Fun, JavaScript

location = location
... and 534 other ways to reload the page with JavaScript

How many ways you can think of when you want to reload the current page with JavaScript? I counted 535 before I got bored, maybe someone can pick up from there? The cases are so much that I had to write a script to generate them 🙂

» have fun, see for yourself

Just occurred to me that I didn't even include the frames property in those 535 ways. Consider the limitless possibilities having in mind for example that:

>>> window.frames === window
true
>>> frames === window.self
true

Could you come up with 500 more ways? A 1000? One condition: no recursion, for example window.self.window is not allowed.

Comments? Find me on BlueSky, Mastodon, LinkedIn, Threads, Twitter