I have made a userscript for a forum that resizes images. It works great, except for after posting or editing where it redirects, where onreadystatechange
does not fire in Google Chrome.
When viewing a thread, EG SomeSite/forums.php?action=viewtopic&topicid=205362, the userscript works.
After editing/posting, EG SomeSite/forums.php?action=viewtopic&topicid=205362&page=p4976670#4976670, the userscript doesn't work.
The problem lies with this code:
document.onreadystatechange = function () {
if (document.readyState == "complete") {
//Call function
}};
I wait for all resources to be loaded, because the resizing is inconsistent otherwise on pages with many images.
The script works perfectly in Firefox with Greasemonkey.
Any idea why onreadystatechange
does not fire on Chrome after a redirect? Is there a better way to wait for resources to have been loaded?