Jump to content

Internet Explorer Only Error


Petty_Crim

Recommended Posts

I am getting this weird error with Internet explorer when I try viewing my php page. The page works 100% fine in Firefox but IE doesn't like it oddly. The page itself does not use any XML that I know of so I have no idea why I get this error.

 

The IE debugger says the following:

xml documents cannot contain multiple root level documents

 

I am using php include in the page could this be the problem?

I am also adding a link to a css file and a js file at the end of the page outside of the php.

 

 

The page doesn't seem to be loading the javascript or css files so I am thinking it might be something to do with their positioning, it works fine in Firefox but IE doesn't seem to load them at all.

 

This is how my page is setup:

<?php
include 'content.php';
?>
<script src="js_file.js"></script>
<link rel="stylesheet" type="text/css" href="css_file.css" />

 

Link to comment
Share on other sites

What doctype are you using? And what mime-type are you using? I would guess that you are using an XHTML doctype and an application/xhtml+xml mime type. IE doesn't recognize this mime type.

I am not using any doctype/mime-type if that makes sense. I don't have the line that says the doc type / mime-type cause I am using php.

 

I've never bothered with that stuff does it make a difference?

Link to comment
Share on other sites

I am not using any doctype/mime-type if that makes sense. I don't have the line that says the doc type / mime-type cause I am using php.

 

I've never bothered with that stuff does it make a difference?

 

Yes, it makes a big difference. Although that is probably not what is causing your problems this time.

 

You are using (x)html whether you realize it or not. PHP is simply the tool you are using to output your (x)html. So PHP is the tool, and (x)html is the product.

 

If you don't have a doctype and a mime-type, then browsers have to take a wild guess at what kind of (x)html you are using. Each browser will guess differently, meaning that its a wild guess as to how your page will look in the different browsers. A doctype is necessary to tell the browser exactly what type of code you are giving it, then you have to make your code conform to that datatype.

 

You should really have learned all this stuff before starting PHP. Its like practicing cooking without knowing anything about the ingredients you are using. Whatever you get is going to be unreliable, and if it turns out ok, its going to be pure luck.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.