www.webdeveloper.com
Results 1 to 3 of 3

Thread: Embedding (Local) Javsascript with Firefox Addon...

Hybrid View

  1. #1
    Join Date
    Jun 2010
    Posts
    64

    Embedding (Local) Javsascript with Firefox Addon...

    I have a .js which I want my Firefox addon to embed into a page.

    I've tried the below but it's not working:
    Code:
    var script = window.content.document.createElement("script");
    	script.setAttribute("src", "chrome://file.js");
    	script.setAttribute("type", "text/javascript");
    	script.onload = function()	{
    		// Onload script load events
    	}
    window.content.document.body.appendChild(script);
    Anyone got any ideas?

    Note:
    I can't just run the .js "on the addon" so to speak because it includes references like "document.body" which when you write on an addon are "window.content.document.body", etc.
    Is there a way around this?

  2. #2
    Join Date
    May 2006
    Location
    Somewhere behind your screen
    Posts
    1,637
    as i know Greasemonkey deals good with document.body
    xxx: Guess Buddhist riddle: "What is the sound of one hand clapping?"
    yyy: facepalm

  3. #3
    Join Date
    Jun 2010
    Posts
    64
    Quote Originally Posted by Padonak View Post
    as i know Greasemonkey deals good with document.body
    Greasemonkey is a seperate addon though - I've made my own just need to solve this problem though. There has to be a simple embedding solution...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles