Incorrect Mozilla renderings

N

No One

For whatever reason, when an ASP.Net control sees that the browser is
Mozilla based, it returns HTML code that contains things like <font />
tags while returning style attributes for IE. I am testing against the
latest Firefox browser and not the old stinky Netscape 4. Is there a
way to tell the ASP.Net server to treat Mozilla as a new browser?
 
R

Rick Strahl [MVP]

By default ASP.NET doesn't recognize Mozilla or FireFox as uplevel browsers
and renders using HTML 3.2.

There are a number of ways to fix this by overriding Machine.Config or your
Web.Config and the browserCaps section that defines what various browser
signatures support.

The easiest way to force all access to automatically use HTML 4.0 is to
simply force all output to go to the HtmlTextWriter:

<system.web>
<browserCaps>
TagWriter=System.Web.UI.HtmlTextWriter
</browserCaps>
</system.web>

+++ Rick ---

--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/weblog/
http://www.west-wind.com/wwThreads/
 
N

No One

Thanks for the info. I guess M$ can't handle browsers that follow published
standards.
 
T

Ted Harper

Thanks for the info. I guess M$ can't handle browsers that follow published
standards.

I know that is a throwaway line, but the underlying problem is that
the protocol between browser and server doesn't easily allow the
browser to enumerate what "things" it supports (by design or based on
the current user's preference settings), that is, whether JScript
(whatever level) is enabled/disabled, if it supports DHTML (at all,
well vs badly), etc.

So what Microsoft does via part of the server-side config file is
pattern-match the UserAgent string sent in the header for the browser,
then based on that sets a number of capability flags that the ASP.Net
code can then use to "adaptively render" the content in a way that
hopefully the browser can do a good job of showing.

Out of the box the pattern-matching strings don't include the
appropriate ones to detect recent Firefox/Mozilla builds, but if you
add these (to your machine.config or just the specific web.config for
your application if you are distributing it), you'll get a really good
up-level rendering on those browsers.

If you google for something like firefox web.config browsercaps you
should find a paste-in addition so your system does correctly "know"
the capabilities of Mozilla/Firefox family browsers. Specifically
http://aspnet.4guysfromrolla.com/articles/050504-1.aspx has a good
background and a cut/paste section you can simply add to the
web.config for your application.


ted.h.
 
N

No One

Ted said:
I know that is a throwaway line,

Then you would know incorrectly. M$'s track record with following published
standards is notoriously bad.

Out of the box the pattern-matching strings don't include the
appropriate ones to detect recent Firefox/Mozilla builds,

And why not? These browsers are newer than IE's engine and it detects that pile
better.

But thanks for the info.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top