npo.nl has been broken for a while. It worked off and on for videos. At this point the player doesn't even load for any video at all. I didn't have time to contact you earlier which might have been a good thing since the site had a new overhaul. Anyway, can you fix it please?
Here's an example: https://www.npo.nl/de-slimste-mens/24-07-2017/KN_1692128 Live streams are broken as well: https://www.npo.nl/live
Thank you. The script works fine now in Firefox + Greasemonkey.
However, as Firefox is moving towards webextensions I switched to Violentmonkey. The player not loading at all wasn't related to your script but to my switch. I didn't see this coming as youtube.com and rtl.nl work just fine. Now I tried the script in Tampermonkey for Firefox and same problem, player not loading (after allowing cross-site scripting). I enabled verbose debugging in Tampermonkey and this was the output:
ERROR: Execution of script 'ViewTube+' failed! myPageContent is undefined
Could there be a fix for this?
Greasemonkey is the only addon that supports synchronous GM_xmlhttpRequest. I'm using this function many times for this site, make it asynchronous takes a lot of changes.
Firefox also outputs: "Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user’s experience."
So what does this mean for the future when Greasemonkey also moves towards webextensions?
Greasemonkey implemented a new method, GM_xmlhttpRequest:
https://wiki.greasespot.net/GM_xmlhttpRequest "" This method performs a similar function to the standard XMLHttpRequest object, but allows these requests to cross the same origin policy boundaries. ""
Both these methods can make synchronous and asynchronous requests. Synchronous means the browser waits until the method returns a response, asynchronous doesn't, so the user has to create callback methods for it or nest the requests.
Tempermonkey doesn't support synchronous GM_xmlhttpRequest, they say is difficult to implement.
Violentmonkey doesn't support it either, maybe same reason.
Chromium/Chrome supports GM_xmlhttpRequest but only asynchronous.
I don't think moving to the new API means Greasemonkey will drop synchronous support.
Asynchronous is the right way to do the requests but this is for video streaming sites which must have good response times also the user must have good Internet connection so synchronous should work fine.
Changing GM_xmlhttpRequest to asynchronous is not easy for NPO, I have to make 5 requests, one for each video type.
I have yet to decide whether I stick to Violentmonkey or Greasemonkey. Greasemonkey triggers unwanted behaviour in combination with other extensions. I hope they will finish their webextension soon in hopes of better compatibility. Might be a bug in Firefox as well... Anyway, thanks for the info.