I had a similar problem, which broke dhtmlHistory after viewing a pdf or image in a popup window.
I found that after the popup window, when pressing the back button, the browser actually requested the page from the server rather than using its cache. When it re-requests the page from the server, the historyStorage is reset to empty, which prevents dhtmlHistory from working.
To fix this, I set the http Expires header for the page to a time in the future. (Previously we had a Expires : 0 in the header). This ensures the cached version of the page is used, which keeps the historyStorage intact and dhtmlHistory working.
This exact fix may not work for you. Your server may return other headers which may also cause problems.