ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Safari appends .xml to XML Template Type pages

October 09, 2009 12:52pm

Subscribe [2]
  • #1 / Oct 09, 2009 12:52pm

    Kevin Cupp

    791 posts

    Yes, it seems perfectly natural for a browser to append .xml onto a file that is responding as an XML document but doesn’t already have the extension on it, and it normally wouldn’t be a problem.

    Maybe I’m using EE for what it’s not meant to do, but we created a calendar for Tufts Alumni website that also generates an iCal feed, and prompts you to download an ICS file when it’s clicked. I was able to achieve that with this bit of code:

    header('Content-type: text/calendar');
    header('Content-Disposition: attachment; filename="tuftsalumni.ics"');

    It works great in Firefox, but Safari, since I have the template type set to XML, appends a .xml extension on the tuftsalumni.ics file. Normally, if I have these header types set, Safari shouldn’t do this, so I’m guessing EE is also adding some headers during the template rendering process.

    I know this is such an edge case, but does anyone have any ideas? The calendar is here: http://tuftsalumni.org/events-reunions/calendar with iCal link at the top, and individual events also have an iCal link on their detail pages.

    Thanks!

  • #2 / Oct 09, 2009 12:56pm

    Ingmar

    29245 posts

    Maybe I’m using EE for what it’s not meant to do ...

    No, that’s a perfectly reasonable use, I’d say.

    I have the template type set to XML, appends a .xml extension

    Try some other file type, perhaps “Static”? Since this looks very much like a Safari issue, though, I’ll move this thread to Howto.

  • #3 / Oct 09, 2009 1:01pm

    Kevin Cupp

    791 posts

    Static doesn’t seem to work, unfortunately. It just simply outputs the text of the calendar file. It only seems to work properly (prompt for download of an ICS file) when I use the XML type.

  • #4 / Oct 09, 2009 1:08pm

    Ingmar

    29245 posts

    Taking a look at your file, it is indeed server as

    Content-Type: text/xml

    I don’t know if there’s a way to have Safari not save that with an .xml extension. Chrome does the same thing, FF asks. Looks like a browser thing to me.

  • #5 / Oct 09, 2009 2:08pm

    Kevin Cupp

    791 posts

    Unfortunately, I think the only solution is to edit the EE core file. I found where it sets the headers on output, I temporarily changed it to text/calendar to see if it would work, and it fixed the problem. I’m just going to refine it a bit more so that it only does it with that template.

    Thanks anyway!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases