On Thu, Sep 3, 2009 at 8:55 AM, 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>
>

Why can't you just do:
<script src="common.js"></script> ?

> 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.

The reason is that you get a lot of things for free being in a real
HTML environment. For example, you can instance NPAPI plugins. If we
wanted to make the environment pure JS, we'd have to replicate all
these APIs.

- a

--~--~---------~--~----~------------~-------~--~----~
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