jsapi fails with header type "application/xhtml"

76 views
Skip to first unread message

John D'Orazio

unread,
Jul 5, 2011, 3:48:46 AM7/5/11
to google-ajax...@googlegroups.com
I am having errors using the Google JsAPI loader when serving the document as "application/xhtml+xml".
The JsAPI script is using "document.write" to add scripts to the page. It should be using "document.createElement".
Doing an online search I found the bug reported elsewhere, but it needs to be reported to the JsAPI team:

What steps will reproduce the problem?
Step 1. Create a web page using Google JSAPI.
Step 2. Serve as `application/xhtml+xml`
Step 3. Silently fail, Javascript scope fatal errors.

What is the expected output? What do you see instead?
I expect it to not die, or for it to warn with a *very* descriptive alert() telling the developer that the MIME type / browser combo isn't supported.

Jeremy Geerdes

unread,
Jul 5, 2011, 9:08:19 AM7/5/11
to google-ajax...@googlegroups.com
If you send a callback argument to the google.load call, it will use the document.createElement method. Try something like this:

google.load(API|LIBRARY, VERSION, {callback : function(){alert('ready.')}});

Jeremy R. Geerdes
Generally Cool Guy
Des Moines, IA

For more information or a project quote:

If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan Church!

--
You received this message because you are subscribed to the Google Groups "Google AJAX APIs" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-ajax-search-api/-/ZXl8rcLoiLIJ.
To post to this group, send email to google-ajax...@googlegroups.com.
To unsubscribe from this group, send email to google-ajax-searc...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-ajax-search-api?hl=en.

Reply all
Reply to author
Forward
0 new messages