Is Google Closure’s History module giving you a blank page?

Then you probably skimmed over the documentation like I did and missed the part where it says “This object should be created from a script in the document body before the document has finished loading.” Oops. The module uses document.write, so it needs to be called inline! You can’t construct history from, say, a body onload handler. But if you change

<script src="closurestuff.js"></script>
<body onload="doClosureStuff()">
</body>

to 

<script src="closurestuff.js"></script>
<body>
<script>
doClosureStuff();
</script>
</body>


you should be good to go.

blog comments powered by Disqus

Notes

  1. codeshal posted this