Last modified: 2011-03-13 18:06:06 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 12766 - Internet Explorer should be added to javascript browser detection globals
Internet Explorer should be added to javascript browser detection globals
Status: RESOLVED WONTFIX
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
unspecified
All All
: Lowest enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-01-24 02:03 UTC by Andrew Dunbar
Modified: 2011-03-13 18:06 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Andrew Dunbar 2008-01-24 02:03:11 UTC
As wikibits.js already does browser detection and stores its findings where any JavaScript extension besides just wikibits itself can us it, it seems logical that msie should also be detected. There are surely many extensions doing their own ad hoc msie detection in a variety of ways. Extending the wikibits.js browser detection to cover more browsers in one central place must be a good thing. It already detects the following so why not add more?

is_ff2_win
is_ff2_x11
is_gecko
is_khtml
is_opera
is_opera_95
is_opera_preseven
is_opera_seven
is_safari
Comment 1 Daniel Friesen 2008-01-24 04:22:30 UTC
It would actually probably be best to allow extending Site or Extension JS to use special IE only JS pages. As in, those through IE's conditional comments. Or have those scripts automatically add the is_ie and is_ie_?? variables to get the best compatibility.
Comment 2 Splarka 2008-01-24 11:26:40 UTC
Why not simply add belo the other conditionals:

 <!--[if IE]><script type="text/javascript">var is_msie = true;</script><![endif]-->

And anything more detailed than that can check the browser agent version. 
Although in wikibits.js, should be something like:

 if(!window.is_msie) var is_msie = false;

Then you can simply check if(is_msie) or if(!is_msie).
Comment 3 Daniel Friesen 2008-01-25 00:25:52 UTC
Maybe a little more than that... like a is_msie_7, because there is a lot new in IE 7 which will break in previous versions. Same for 6 because the 5 and olders don't have as much as it.

So...

is_msie
is_msie_presix
is_msie_six
is_msie_postsix
Comment 4 Tim Starling 2008-02-23 08:59:43 UTC
(In reply to comment #3)
> Maybe a little more than that... like a is_msie_7, because there is a lot new
> in IE 7 which will break in previous versions. Same for 6 because the 5 and
> olders don't have as much as it.
> 
> So...
> 
> is_msie
> is_msie_presix
> is_msie_six
> is_msie_postsix
> 

Do we really have to repeat the mistakes of the past? Globals are bad because they can't be lazy-initialised. This is true in both JS and PHP. 

If you need the result of a computation, you should call a function to get it, not run the computation on every request and make the result available via a global variable. 

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links