I am using Firefox and Firebug's command line to execute a JavaScript on two different sites:
- https://graph.facebook.com/v2.3/172727819415642/albums?fields=id,name,cover_photo,photos%7Bname,source%7D&limit=1&access_token=xxxxx
- http://www.iskcondesiretree.com/photo/album/list
Here's the code:
(function() {
function r() {
a = $("body").text()
console.log(a);
};
var e = "1.6.4";
var t = false;
if (!t) {
t = true;
var n = document.createElement("script");
n.src = "https://ajax.googleapis.com/ajax/libs/jquery/" + e + "/jquery.min.js";
n.onload = function() {
r();
};
document.getElementsByTagName("head")[0].appendChild(n);
};
})();
When I run this code in Firebug's command line on site 1, it returns the following error:
TypeError: $(...).text() is not a function
When I run this code site 2 it works fine. It shows lot of text from the site.
Interesting thing is, if I change $
to jQuery
it works on site 1, too.
Can anyone tell what's happening? Why Firebug behaves differently for those two sites?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…