0

Hi anyone can help me with converting this into a bookmarklet to load an external site in a iframe inside an overlay like how it is done on http://jquery.com/demo/grey/

thnx

  • What code have you got so far? – redsquare Jul 20 '09 at 13:25
  • javascript:var s=document.createElement(’script’);s.setAttribute(’src’,′http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js’);document.body.appendChild(s); var p=document.createElement(’script’);p.setAttribute(’src’,′http://xyz.com/greybox.js’);document.body.appendChild(p); var c=document.createElement(’link’);c.setAttribute(’href’,′http://xyz.com/greybox.css’);document.body.appendChild(c); $(document).ready(function(){GB_show("Bookmarklet","http://www.gmail.com/",470,600);return false;}); this is what i have so far –  Jul 20 '09 at 17:01

1 Answers1

0

I would put all your actual code in an external file that you just load. See http://paulisageek.com/nodeSelector/.

The bookmarklet code is :

javascript:(
   function() { 
      var s=document.createElement("script");
          s.charset="UTF-8";
          s.src="http://paulisageek.com/nodeSelector/ns.js";
      document.body.appendChild(s)
   })();

which then in tern loads jquery and does some fancy stuff. It also makes updating it much easier (since you don't have to get your users to change the bookmarklet).

Paul Tarjan
  • 48,968
  • 59
  • 172
  • 213