On Thu, Sep 3, 2009 at 4:55 PM, Matias Pelenur<[email protected]> wrote:
>
> I'd like to include a common piece of javascript in my background
> page. So far, the only way I see is adding at the top:
>
> <script>
>  document.write("<script src='chrome-extension://" +
> chrome.extension.id_ + "common.js'/>");
> </script>
>
> That seems ugly for at least two reasons: using document.write to
> write a script tag, and having to use the private chrome.extension.id_
> property, which is not part of the API and could presumably go away
> (perhaps we need a getId() method?).
>
> More generally, why is the background page HTML and not just included
> javascript? Are there use cases for using actual HTML tags in the
> page? It would be nice if we could specify one or more JS files, much
> like content scripts, with the difference that they are instantiated
> once and forever in the Chrome instance. The implementation itself
> could just be including each script in an HTML page, if need be.

Can you not just use:

<script type="text/javascript"
src="file_relative_to_root_of_extension.js"></script>

And yes, there is use for HTML in the background page, for instance I
have an NPAPI plugin loaded in one so that I can make native calls
from my extension

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Chromium-extensions" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/chromium-extensions?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to