Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the drawbacks to setting Page.ClientTarget = "uplevel" for all pages?

We've run into problems recently because as of Firefox 4's release, ScrollPosition data never gets sent to Firefox users. This is caused by the browsercaps file only specifying capabilities for Firefox 3.x. One solution to this problem is to update the browsercaps file on every server, and any time a new version of Firefox (or Chrome, or whatever) is released. Well, before we've even had a chance to address this problem, we're already on Firefox 6, and it just seems like a race that we don't want to keep running.

It turns out that setting Page.ClientTarget = "uplevel" in the master page (so, for everything, unconditionally) fixes our specific Firefox ScrollPosition issue. What are the negative consequences to this as a solution? Are users of Android browsers going to have a worse experience? Are they simply going to be downloading unnecessarily larger pages now? Is there any reason we shouldn't do this?

The documentation for Page.ClientTarget is pretty scary:

uplevel , which specifies browser capabilities equivalent to Internet Explorer 6.0.

.. and seems wrong, or at least misleading. It seems like it was written at a time when IE6 was the most capable browser. Does "uplevel" really mean "assume the browser is capable of everything" or "treat it like you'd treat IE6"?

like image 382
Greg Smalter Avatar asked Aug 17 '11 18:08

Greg Smalter


2 Answers

If you want to tell WebForms to effectively "lay off" then setting Uplevel works, although you want to do it in Page_Init which is earlier than the Master Page. At this point, WebForms will assume everyone is a newer browser than you're on your own.

like image 146
Scott Hanselman Avatar answered Nov 01 '22 03:11

Scott Hanselman


For server-side compatibility, which can't test the browser's actual limitations, I prefer using a blacklist instead of a whitelist: if a browser isn't known to not support feature X then I assume it supports it.

You can also blacklist all versions of a browser, e.g. no version of IE supports feature X). this requires you to update the blacklist once IE does support feature X.

Browser upgrades shouldn't break this scheme.

like image 26
orip Avatar answered Nov 01 '22 02:11

orip