C
Chris Mahoney
Hi
I have two machines, one running Win 2000 and VS.NET 2002, and one running
Mac OS 10.2.
I can develop web apps on my Windows machine, and look at them in IE, and
they look fine. But if I try to view my pages in Safari (Apple's web
browser) on my Mac, there are various formatting problems. I've investigated
what's happening and it seems that ASP.NET is discriminating against Safari
(and other browsers).
For testing, I set up a simple ASP.NET page with a single TextBox on it,
which I resized. It uses the following line of code:
<asp:textbox Height="50" ID="TextBox1" runat="server" TextMode="MultiLine"
Width="350" />
Now, I can open the resulting page using IE, and if I look at the HTML code
generated by ASP.NET (by using View Source), the line responsible for
drawing the TextBox is:
<textarea name="TextBox1" id="TextBox1"
style="height:50px;width:350px;"></textarea>
That line contains all the code necessary to draw the TextBox to the size I
want, and displays fine in IE. However, opening the same page in Safari and
looking at the source, I see this code:
<textarea name="TextBox1" id="TextBox1"></textarea>
Huh? Where's all the sizing information gone? The TextBox sizes itself to
whatever the default is, which is nowhere near as large as what I want it to
be. Well maybe Safari isn't capable of drawing the TextBox to the required
size? But I've checked this out too, and that's not the problem. By enabling
the debugging functions in Safari, there's now an option for changing the
user agent and pretending you're a different browser. So I set the user
agent to IE6 on Windows, and voila, the TextBox now appears the correct size
in Safari. I looked at the various user agents available in Safari (Mozilla
1.1, Netscape 7.0, Netscape 6.2.2, Netscape 4.79, Mac IE 5.22, Windows IE
6.0, and Konqueror 3), and all of those user agents, which the exception of
the IE ones, receive this "butchered" code.
I proceeded to open up my "proper" site, which is loaded with controls and
formatting problems, set Safari's user agent to IE6 for Windows, and the
site appears almost perfectly! Most of the formatting problems I was having
have completely disappeared.
So my question is, why is ASP.NET removing all the formatting code if the
browser isn't IE, and most importantly, how do I stop it from doing this?
Thanks
Chris
I have two machines, one running Win 2000 and VS.NET 2002, and one running
Mac OS 10.2.
I can develop web apps on my Windows machine, and look at them in IE, and
they look fine. But if I try to view my pages in Safari (Apple's web
browser) on my Mac, there are various formatting problems. I've investigated
what's happening and it seems that ASP.NET is discriminating against Safari
(and other browsers).
For testing, I set up a simple ASP.NET page with a single TextBox on it,
which I resized. It uses the following line of code:
<asp:textbox Height="50" ID="TextBox1" runat="server" TextMode="MultiLine"
Width="350" />
Now, I can open the resulting page using IE, and if I look at the HTML code
generated by ASP.NET (by using View Source), the line responsible for
drawing the TextBox is:
<textarea name="TextBox1" id="TextBox1"
style="height:50px;width:350px;"></textarea>
That line contains all the code necessary to draw the TextBox to the size I
want, and displays fine in IE. However, opening the same page in Safari and
looking at the source, I see this code:
<textarea name="TextBox1" id="TextBox1"></textarea>
Huh? Where's all the sizing information gone? The TextBox sizes itself to
whatever the default is, which is nowhere near as large as what I want it to
be. Well maybe Safari isn't capable of drawing the TextBox to the required
size? But I've checked this out too, and that's not the problem. By enabling
the debugging functions in Safari, there's now an option for changing the
user agent and pretending you're a different browser. So I set the user
agent to IE6 on Windows, and voila, the TextBox now appears the correct size
in Safari. I looked at the various user agents available in Safari (Mozilla
1.1, Netscape 7.0, Netscape 6.2.2, Netscape 4.79, Mac IE 5.22, Windows IE
6.0, and Konqueror 3), and all of those user agents, which the exception of
the IE ones, receive this "butchered" code.
I proceeded to open up my "proper" site, which is loaded with controls and
formatting problems, set Safari's user agent to IE6 for Windows, and the
site appears almost perfectly! Most of the formatting problems I was having
have completely disappeared.
So my question is, why is ASP.NET removing all the formatting code if the
browser isn't IE, and most importantly, how do I stop it from doing this?
Thanks
Chris