To properly initialize the options for history.js, the options must be set before the script is included on the page. This could look similar to the following:
<script type="text/javascript" language="javascript">
window.History = { options: { html4Mode: true} };
</script>
<script src="/scripts/jquery.history.min.js" type="text/javascript"></script>
If it is a requirement that the HTML4 flag be set on DOM ready, then you can use the delayInit option in the same way. Just note that you must call History.init() manually when you're 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;
//some code gathering user input or something
window.History.options.html4Mode = userInput;
window.History.init();
);
</script>
Sources:
https://github.com/browserstate/history.js/pull/195
https://github.com/browserstate/history.js/issues/303
Note: I've successfully used the method demonstrated in the first example. The second I have not tested personally.