🏠 Home 

Heise.de Forum: all comments on one page v2

All comments on one page, iReply, quick-vote, user-scores.

< Feedback on Heise.de Forum: all comments on one page v2

Question/comment

§
Posted: 2017-10-22
Edited: 2017-10-22

Script not working with Violentmonkey: document.getElementById(...) is null

Script runs fine with Tampermonkey (but syntax check shows 80 warnings/errors - including 4 easy to fix missing semicolons)
Script does not run with Violentmonkey, tested with Firefox, but another user already reported the same with Violentmonkey on Chrome...

Error from Firefox Browser Console:
Error running script: Heise.de Forum: all comments on one page v2
TypeError: document.getElementById(...) is null
document.getElementById(...) is null

Edit: Used script version 2.5.0

jn 2Author
§
Posted: 2017-10-31

So I installed Violentmonkey in Firefox 52.4 (ESR) and can confirm the script does not run. I did not notice any Violentmonkey or user script-related error messages.
I noticed following error message in the console wich does not appear under Greasenmonkey:
Content Security Policy: Die Einstellungen der Seite haben das Laden einer Ressource auf blob:https://www.heise.de/4c95f33f-bc65-48ad-89e4-3d8b6adc692c festgestellt ("default-src https://www.heise.de data: 'unsafe-inline' 'unsafe-eval' https:"). Ein CSP-Bericht wird gesendet.
(Note the "fake" URI).
However, the user script runs fine when I activated Javascript for the heise.de domain and the above message does not appear any longer.
And I think you need to allow cookies for heise.de (I did not test it without cookies this time).

And there is a pile of Content Security Policy errors on heise.de when Javascript is disabled:
Content Security Policy: Die Einstellungen der Seite haben das Laden einer Ressource auf self blockiert ("script-src 'unsafe-eval' *"). Source: var _sf_startpt=(new Date()).getTime().
and so on... don't know if this could be the cause. But the script runs fine under Greasemonkey without site Javascript.

§
Posted: 2019-02-25

This error TypeError: document.getelementbyid(...) is null would seem to indicate that there is no such element with an ID passed to getElementById() exist. This can happen if the JavaScript code is executed before the page is fully loaded, so its not able to find the element. The solution is that you need to put your JavaScript code after the closure of the HTML element or more generally before < /body > tag.

Post reply

Sign in to post a reply.