I guess different request headers are sent by default. Try checking it in the inspector in the network tab or use Fiddler app.
Any example outputs? What is the url you have used for testing?
btw, I think is better to use JSON.parse
than eval
.
Try this: http://www.dm5.com/m129373/chapterfun.ashx?cid=129373&page=1
If you eval the response text it should give an array:
GM_xmlhttpRequest values:
http://manhua1021.104-250-142-226.cdndm5.com/11/10410/129373/1_8081.png?cid=129373&key=b349856c835e4e849e6e5ecbf6e5e54e http://manhua1021.104-250-142-226.cdndm5.com/11/10410/129373/2_1555.png?cid=129373&key=b349856c835e4e849e6e5ecbf6e5e54e
XMLHttpRequest values:
http://manhua1021.104-250-142-226.cdndm5.com/11/10410/129373/1_8081.png?cid=129373&key=dc6cdb99e41f6b698ff5a0ae1305a1db http://manhua1021.104-250-142-226.cdndm5.com/11/10410/129373/2_1555.png?cid=129373&key=dc6cdb99e41f6b698ff5a0ae1305a1db
notice how the "key" part of the strings are different.
Also if I use the GM_xmlhttpRequest
method, it doesn't show up in the network tab.
it doesn't show up in the network tab.
Use Fiddler.
I found the problem. No referer header is being sent. It seems that by default it GM_xmlhttpRequest
doesn't send a referer header so I needed to specify.
Ty guys. Still don't get why I had to use fiddler just to see this.
gm_xmlhttprequest vs xmlhttprequest
I've across something a bit weird.
vs
For all intensive purposes, these two functions should return the same response text.(Cross origin is not an issue.) However, when I check the console log, the response for
GM_xmlhttpRequest
is incorrect. It is near identical but not quite the same as the response I get formXMLHttpRequest
.Any ideas on what might be causing this?