For the version where you placed the script tag in the background page, did
you include a permissions section in your manifest?


For the content script version, the way to inject an external script is
something like this:

var script = document.createElement("script");
script.src = "http://www.google.com/jsapi";;
document.body.appendChild(script);

One problem you could then run into with this approach is not knowing for
sure when the network request has actually finished.



On Thu, Nov 19, 2009 at 8:03 PM, vm <vmantr...@gmail.com> wrote:

> Hello:
>
> I am trying to use the javascript version of the google calendar API v.
> 1 with no success. I want to access the library from a content script.
> I tried creating a .js with the code in "http://www.google.com/jsapi";
> and referencing it in the manifest as a content script, but It did not
> work. I put the library first and my content script after in the
> manifest array for js.
>
>  Then I  tried using a background page as shown below, but it did not
> work either. I think that this should be because of the "isolated
> world" architecture.
> For both cases I get the same error message shown bellow. It seems
> that nothing is being loaded, no library at all.
>
> ERROR MESSAGE: cannot read property 'calendar' of undefined
>
> Well, I am not very familiar with these technologies, still learning.
> Excuse my inexperience.
> Can someone tell me the standard way of using an external javascript
> library in a content script? What is wrong in my code?
>
>
> I would appreciate any assistance
> Thanks.
>
> /////////////background page......//////////
> <html>
> <head>
>        <script type="text/javascript" src="http://www.google.com/
> jsapi">
>              google.load("gdata", "1");
>        </script>
> </head>
> <body >
> </body>
> </html>
>
>
>
> //***********content script............................ERROR MESSAGE:
> cannot read property 'calendar' of undefined
>
> google.load("gdata", "1");
>
> google.setOnLoadCallback(getMyFeed);
>
> function getMyFeed()
> {
>
>  try{
>       var calendarService = new google.gdata.calendar.CalendarService
> ('example01');
>     }
>  catch(Error)
>    {
>     alert(Error);
>     }
>
> }
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Chromium-extensions" group.
> To post to this group, send email to chromium-extensi...@googlegroups.com.
> To unsubscribe from this group, send email to
> chromium-extensions+unsubscr...@googlegroups.com<chromium-extensions%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/chromium-extensions?hl=.
>
>
>

--

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


Reply via email to