Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Firefox application/xhtml+xml problem


Go to End
Reply


9 Posts   7090 Views

Avatar
Ofir Picazo

Google Summer of Code Hacker, 7 Posts

7 June 2007 at 5:49pm

I've come across a very odd problem with Firefox, seems like it changes the js functions available when using xhtml+xml doctype. I found that out when trying to use GoogleMaps on a Silverstripe site who served application/xhtml+xml.
An easy fix is to remove the first line on the default template:

<?xml version="1.0" encoding="UTF-8"?>

That will make Silverstripe serve text/html instead.

More Info: http://groups.google.com.gi/group/Google-Maps-API/browse_thread/thread/139dddaa9f726c1b/#

Avatar
Will

Google Summer of Code Hacker, 7 Posts

7 June 2007 at 6:34pm

Have you looked into making an iFrame to hold the map stuff?

It ought to be possible to make an iFrame to override the content type, and then write your map stuff in there.

The easy way to do this would be to have the iFrame actually be on the page with no source set, for example
<iframe id="iframe_id" src="" type="text/html"></iframe>

Then JavaScript could populate it with code along the lines of:

var iFrame = document.frames["iframe_id"];
iFrame.document.open();
iFrame.document.write("<html>...</html>");
iFrame.document.close();

the 'iFrame.document' code only works in some browsers, but there are equivalents to it in pretty much everything.

It's also possible to both create and populate the iFrame in javascript, though it takes a bit more work; that method gives a bit more control over dynamic sizing stuff.

Hope this is helpful.

--Will

Avatar
Ofir Picazo

Google Summer of Code Hacker, 7 Posts

8 June 2007 at 2:05am

Edited: 08/06/2007 9:17am

Thanks Will, I'll look into it, though I've never liked iframes too much, I suppose they are necessary sometimes.

Avatar
laktek

Google Summer of Code Hacker, 76 Posts

8 June 2007 at 9:17am

Ofir, are u using javascript on the page under a CDATA block ?

The problem of Silverstripe using XHTML+Xml rather than text/html is when working with the external API's where we don't have any control of produced output.

Is there any way to strip html special characters of the variables used in templates ?

Avatar
mandrew

Core Development Team, 36 Posts

9 June 2007 at 2:03pm

Yeah; the whole application/xhtml+xml thing is a bit of a bug-bear. It's a sad truth that much of the world isn't ready for XHTML - even the developers at Google!

You could also disable the application/xhtml+xml delivery when your module is used, by calling BasicAuth::disable() in the generator method for your map control.

Avatar
Ofir Picazo

Google Summer of Code Hacker, 7 Posts

12 June 2007 at 4:35pm

Thanks guys, I'll test the BasicAuth::disable() fix and let you know how it goes.

Avatar
Ofir Picazo

Google Summer of Code Hacker, 7 Posts

4 July 2007 at 5:19pm

The BasicAuth::disable() trick didn't do it Mandrew, but thanks for the advice.

Avatar
Willr

Forum Moderator, 5513 Posts

4 July 2007 at 8:11pm

To disable the xhtml/html switching try use ContentNegotiator::disable() in _config.php.

Go to Top