Internet Explorer refuse d'ouvrir mon fichier...

WRInaute discret
Bonjour à tous !

J'utilise Mozilla pour développer mon site web et tout fonctionne comme sur des roulettes, sauf que hier mon patron me dit, il faut que l'affichage soit optimal sur IE...J'essai et là ce n'est pas le drame mais le fou rire...

Internet Explorer 7 me dit "Voulez vous enregistrer ce fichier où rechercher un programme en ligne permettant de l'ouvrir"... :lol: (avec un petit avertissement de sécurité en prime !)

Je travaille avec easyphp, le fichier qu'il ne comprend pas est tout simplement "index.php", si vous pouviez m'aider ce serait génial...
 
WRInaute impliqué
tout simplement parce que explorer 6 ne comprend pas ce mime

http://www.w3.org/MarkUp/2004/xhtml-faq#ie

Include at the top of your document the line in bold here:

<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet type="text/xsl" href="copy.xsl"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

where copy.xsl is a file that contains the following:

<stylesheet version="1.0"
xmlns="http://www.w3.org/1999/XSL/Transform">
<template match="/">
<copy-of select="."/>
</template>
</stylesheet>

Note that this file must be on the same site as the document referring to it.

Although you are serving the document as XML, and it gets parsed as XML, the browser thinks it has received text/html, and so your XHTML 1.0 document must follow many of the guidelines for serving to legacy browsers.

Your XHTML document will continue to work on browsers that accept XHTML 1.0 as application/xml.

ou alors, comme le suggère ce site

Here’s how we do that bit in PHP:
if(stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml")) { }
Q Values

Now, we need to check the “Q values” which the browser says that it likes. “Q values” are a value between 0 and 1 which the browser can give for each mime type which it says it can deal with - “1” the browser really likes, “0” it hates. So, even if the browser says that it can deal with “application/xhtml+xml”, if it says it prefers “text/html” then that is how we should send the document. This is simply done with a couple of regexes.

$mime = "text/html";
if(preg_match("/application\/xhtml\+xml;q=0(\.[1-9]+)/i",
$_SERVER["HTTP_ACCEPT"], $matches)) {
$xhtml_q = $matches[1];
if(preg_match("/text\/html;q=0(\.[1-9]+)/i",
$_SERVER["HTTP_ACCEPT"], $matches)) {

$html_q = $matches[1];
if($xhtml_q >= $html_q) {
$mime = "application/xhtml+xml";
}
}
} else {
$mime = "application/xhtml+xml";
}
 
WRInaute discret
Ca "fonctionne"...Enfin je vois l'ampleur du désastre...

Le gros soucis est que ça modifie beaucoup d'éléments de mon affichage y compris sous Firefox !). Dois je le refaire comme ça ?
 
WRInaute discret
J'ai opté pour l'instant pour la solution de la facilité : j'ai tout simplment enlevé le mime et mit une simple balise meta...Quelles conséquences cela peut avoir ?

Ancien code :
Code:
<?php
$mime = "application/xhtml+xml";
header("Content-Type: $mime;charset=$charset");
 
WRInaute accro
c l'avantage de développer directement sur les deux plateformes... ca évite les gros problèmes :)

Bon sinon à part ca, oui tu as du boulot pour tout remettre en place sur IE et Firefox :)
 
Discussions similaires
Haut