To properly initialize the parameters for history.js, the parameters must be set before the script is included in the page. It might look something like this:
<script type="text/javascript" language="javascript"> window.History = { options: { html4Mode: true} }; </script> <script src="/scripts/jquery.history.min.js" type="text/javascript"></script>
If you want the HTML4 flag to be set in the DOM, you can use the delayInit parameter in the same way. Just keep in mind that you must call History.init () manually when you are ready:
<script type="text/javascript" language="javascript"> window.History = { options: { delayInit: true} }; </script> <script src="/scripts/jquery.history.min.js" type="text/javascript"></script> ... <script type="text/javascript" language="javascript"> $(document).ready(function () { var userInput = true; </script>
Sources: https://github.com/browserstate/history.js/pull/195 https://github.com/browserstate/history.js/issues/303
Note. I successfully used the method demonstrated in the first example. I have not personally tested the second one.
source share