Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Firefox text/html problem

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

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

Page: 1 2
Go to End
Author Topic: 6895 Views
  • Ofir Picazo
    Avatar
    Google Summer of Code Hacker
    7 Posts

    Firefox text/html problem Link to this post

    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 text/html.
    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/#

  • Will
    Avatar
    Google Summer of Code Hacker
    7 Posts

    Re: Firefox text/html problem Link to this post

    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

  • Ofir Picazo
    Avatar
    Google Summer of Code Hacker
    7 Posts

    Re: Firefox text/html problem Link to this post

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

  • laktek
    Avatar
    Google Summer of Code Hacker
    76 Posts

    Re: Firefox text/html problem Link to this post

    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 ?

  • mandrew
    Avatar
    Core Development Team
    32 Posts

    Re: Firefox text/html problem Link to this post

    Yeah; the whole text/html 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 text/html delivery when your module is used, by calling BasicAuth::disable() in the generator method for your map control.

  • Ofir Picazo
    Avatar
    Google Summer of Code Hacker
    7 Posts

    Re: Firefox text/html problem Link to this post

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

  • Ofir Picazo
    Avatar
    Google Summer of Code Hacker
    7 Posts

    Re: Firefox text/html problem Link to this post

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

  • Willr
    Avatar
    Forum Moderator
    5508 Posts

    Re: Firefox text/html problem Link to this post

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

    6895 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.