IE printing out source code at random (seems very nondeterministic)
-
21-08-2019 - |
Question
Hey. the busted website is: www.mgxvideo.com/mgxcopy-alpha-3, and the specific error that I'm getting is the thing where IE prints out all my source code.
As far as I can tell, the error is appearing at random in IE6, 7, and 8, but it's a commonly occuring error. I'm looking for explanations, debugging tools, fixes. Anything is appreciated, because I'm fully stuck.
Here's how to reproduce:
- Add item(s) into cart.
- At the display cart (the url shud end with cart_display_ie.php)
- Use the shipping calculator over and over and over again until you get the error. It's happened one the first, second, 5th, and the 17th try.
- Reset cookies to restart from fresh
Here are some possibly relevant details
- 1and1 hosting, php from scratch, and mysql
- I'm using Mark Sanborn's php code to interface with UPS's servers.
- I'm using a local DTD for xhtml transitional 1.0
- This error also appears in the checkout cart and also seems associated with the UPS function.
- This isn't directly relevant, but IE also plagues me with "The XML page cannot be displayed."
- Occassionally, the "The XML page cannot be displayed" is displayed as a small canvas within the context of a source print like the error I'm printing. It'll appear near the location of the error in html source, except the canvas has a really small width and height, and not display any further source code afterwards. I've fixed all these errors; they were all caused by improper syntax or w3 rationing of DTD downloads.
- The cart_display*.php is responsible for adding products, removing products, and calculating shipping.
- Sometimes it's something stupid like custom settings on my computer b/c I tweak with random settings that cause side effects. But I've tested in msft's VirtualPC, and had friends reproduce the error.
Here are some resources of similar problems. I haven't tried them because--even if they work--they mean that the website doesn't work at typical/default settings.
- http://www.techsupportforum.com/microsoft-support/internet-explorer-forum/168285-ie7-problem-printing-html-xml-source-rendering.html
- http://www.computing.net/answers/windows-xp/ie6-printing-problem/160128.html
Like I said: any explanations, tools, guesses, or fixes are fully appreciated. I'm trying to finalize the site so I can present it as a beta within the week, and I'm fully stuck. Also, is there a workaround (like a tag) that can hide this error from the user?
Solution
I grabbed a network capture of the repro using Fiddler (www.fiddler2.com).
It looks like you're sending an HTML comment containing a webservice result before the HTML body. It further looks like IE is subsequently sniffing this as an XML body instead of a HTML response.
It appears that if you move your HTML comment inside your HTML tag, the problem goes away.
Note that you should confirm changes in a new browser tab. Once IE is on an XML page, simply hitting F5/Refresh isn't necessarily going to show you the HTML content properly due to caching of the MIME-type decision.
OTHER TIPS
To resolve this issue, you need to re-register two dlls. Open a elevated command prompt and type following commands regsvr32 /i mshtml.dll regsvr32 /i shdocvw.dll
For detailed fix steps, visit http://geekzsupport.com/internet-explorer-prints-html-source-code/