Hi Alan,

To test if jQuery exists, you could try:

if(typeof jQuery != 'undefined') {
        // do something
}


--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 23, 2008, at 1:20 PM, Alan Gutierrez wrote:


I have a bookmarklet that reads like so...

<a href="javascript:(function() {
   var script = document.createElement('script');
   script.src = 'http://thinknola.com/files/superduper.js';
   document.getElementsByTagName('head')[0].appendChild(script); })();
   ">Super Duper!</a>

Here is superduper.js

SuperDuper = {
   load: function() {
       alert('Loaded!');
   }
};

(function() {
   var script = document.createElement('script');
   script.src = 'http://jquery.com/src/jquery-latest.js';
   document.getElementsByTagName('head')[0].appendChild(script);
   script.onreadystatechange = function () {
       if (script.readyState == 'complete') {
           SuperDuper.load();
       }
   }
})();

My target platform is Firefox only. It's probably better as a Greasemonkey script, but thought this would be easier. However, I can't figure out how to detect if jquery.js is loaded. What is the equivalent to the above IE code on Firefox? Or should I just poll to see if something like jQuery.fn.each exists?

--
Alan Gutierrez | [EMAIL PROTECTED] | http://blogometer.com/ | 504 717 1428
Think New Orleans | http://thinknola.com/



Reply via email to