Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

File under: Unintended Consequences. Also, Postel's law could probably be tricked into admitting itself as an accomplice.

1. Browser based Javascript provides a location object for managing and accessing the current browser location, and this location object is available as a global variable.

2. Browser based Javascript also provides a special case in the interpreter/processer/etc., where setting the location object equal to itself will reload the current page. This is also true for certain properties of the location object (href)

3a. There is also a more conventional reload method on the location object which accepts either a location object or string href. Also, many of the "go to this URL methods" exposed to Javascript will interpret "go to the url I'm at" as a request to reload the page. Many of these methods will accepts a location object, or a string representation of a URL as a paramater.

3b. location.href is a string representation of a URL

3. There are many ways to access global variables in Javascript. There are many ways to assign a value in javascript. There are many ways to call a method in javascript.

4. All of the above can be combined into lots (likely more than the 535) of ways to achieve the same thing.



Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: