views:

42

answers:

1

(Can't think of a good title :(( )

Hey all,

I'm developing a bookmarklet. When clicked on it creates a toolbar on the page the user is looking at. The above involves pulling various javascript and css files from my server and injecting them into the pages DOM.

I don't want to encode toolbar's HTML as a string inside one of my javascripts. So I've tried using hidden iframes to load my toolbar and then grabbing a fragment of html to insert, but immediately ran into cross-domain issues.

One solution spring to mind is sending my toolbar's html in JSON, but that seems a bit "hacky"?

What would be a good solution to the problem avoiding difficult-to-maintain html strings in javascript?

Thanks.

+1  A: 

Don't know if it will help, here are 2 examples of toolbar bookmarklets:

  1. diigolet : www.diigo.com/tools/diigolet
  2. fytch it : fytch.com/about/get-started
yupp