Maybe: document.write('<scr' + 'ipt src="myfile.js"></scr' +
'ipt>'); ?

On Dec 5, 9:37 pm, starach <[email protected]> wrote:
> Hello,
>
> I'm currently working on extension that allows to add RSS Feeds as
> bookmark folders. ( like in Firefox )
>
> After finishing some scripting I've decided to split the code into
> separated files. When I run it, inside head section everything is
> fine. New lines with script tag are added but it seems to me like they
> have no effect. What I mean is, script files don't want to load
> themselves and as a result I see inside console fallowing error:
> Uncaught ReferenceError: Background is not defined - chrome-
> extension://:id:/script/autoload/background.js:23
>
> function Autoload() {}
> Autoload.aFiles = new Array('options', 'background')
> Autoload.includeScript = function($sFile)
> {
>         if(document.createElement && document.getElementsByTagName)
>         {
>                 $Head = document.getElementsByTagName('head')[0];
>                 $Script = document.createElement('script');
>                 $Script.setAttribute('type', 'text/javascript');
>                 $Script.setAttribute('src', $sFile);
>                 $Head.appendChild($Script);
>         } else
>         {
>                 console.log("ERROR: Browser does not support dynamic element
> creation.")
>         }}
>
> Autoload.init = function()
> {
>         for($index in Autoload.aFiles)
>         {
>                 
> Autoload.includeScript("script/"+Autoload.aFiles[$index]+".js");
>         }
>         Background.init(); // Where error is
>
> }
>
> window.onload = Autoload.init();

--

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