Got malformed xml via GM.xmlHttpRequest?
Try to actually use your fallback code for xml parser:
onload: function(r) {
var responseXML = r.responseXML ||
new DOMParser().parseFromString(r.responseText, "text/xml");
isCommercial(responseXML);
console.log("XML response:");
console.log(responseXML);
}
Thanks for your answer. I tried it and it's the same result :(
But I noticed that the XML response URL isn't even the one specified in requestHTML("https://blabla.bla")
but the one from the site you are currently at:
https://i.imgur.com/F7ELPH6.png
I hope that's just a consequence of the parsererror because I have no idea why that should happen.
It means you can't use XML parser on an HTML document. Use DOMParser with text/html:
onload: function(r) {
var doc = new DOMParser().parseFromString(r.responseText, "text/html");
isCommercial(doc);
console.log(doc);
}
oh niceee it works :) Thanks a lot!
Got malformed xml via GM.xmlHttpRequest?
I'm trying to check in the background if a linked website has the text "Gewerblicher Nutzer" (Commercial user) at a certain position. The xpath is correct, I ran several different tests.
But apparently the problem is further up, I only get a parsererror back.
What can I do, where is the mistake? Hopefully not some async/promise problem again :dizzy: