Mending a bug in our SAP BW web application, I need to call two javascript functions from the web framework library upon page load. The problem is that each of these functions reloads the page as a side-effect. In addition, I don't have access to modify these functions.

Any great ideas on how to execute a piece of code on "real" page load, then another piece of code on the subsequent load caused by this function, and then execute no code the third reload? 

My best idea so far it to set a cookie on each go to determine what to run. I don't greatly love this solution. Anything better would be very welcome. And by the way, I do realize loading a page three times is absolutely ridiculous, but that's how we roll with SAP.
['https://Stackoverflow.com/questions/114417', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4333/']
A cookie would work just fine. Or you could modify the query string each time with a "mode=x" or "load=x" parameter.

This would present a problem if the user tries to bookmark the final page, though. If that's an option, the cookie solution is fine. I would guess they need cookies enabled to get that far in the app anyway?
This might be a cute case for using window.name, 'the property that survives page reloads'.