SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Enthusiast Nick Karpov's Avatar
    Join Date
    Jan 2007
    Location
    Toronto Ontario
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    A little help with remote JS

    Hey all,

    I'm coding a Firefox extension and I'm running into a problem. I've added a simple extra selection when you right click in the browser and I want it to execute some JS code.

    That JS code is always going to be the same until I update the add-on with new JS code (meaning all the users will have to update their add-ons for it to work).

    I want to make it more dynamic. I want it to execute JS code that is remotely hosted ex.

    Code JavaScript:
    oncommand="some_function_in_a_remotely_hosted_JS_file"

    Of course, I can always just make the Javascript import from a remote host but then it won't quite be dynamic, and if something has changed on the remote host, then you need to restart the browser for it to reload the "new" JS code.

    Can anyone point me in the right direction? Thanks a lot!

  2. #2
    SitePoint Wizard chris_fuel's Avatar
    Join Date
    May 2006
    Location
    Ventura, CA
    Posts
    2,750
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not tested but if it were possible, you might want to try dynamically adding in a dom element with a reference to the external js, then have it run the requested function. So it would in theory be something like:

    Code:
    oncommand="load_remote('remote.js); function();"
    I think I did dynamic loading of script elements at one point, but I can't seem to recall if it worked or not. However if there was a way I'd probably lean towards that.


Bookmarks

Posting Permissions

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