Visit Mozilla.org

Talk:Browser Feature Detection

From MDC

[edit] Example Works (but not from MediaWiki)

The example code (actually, it's more like a DOM test suite) will work now if the Browser Feature Detection#Test Results code is pasted into an HTML template file and run locally. The reason it did not previously work is two-fold:

  1. The _FEATURES data structure found in the ua-features.js file linked to from the original DevEdge article[1] was not pasted here.
  2. It seems (rightly so) that MediaWiki does not allow users to submit arbitrary JavaScript code that can directly execute in a browser like this DevEdge article does. See this MediaWiki mailinglist entry.

So do we:

  1. Leave the test code as it is now; a long listing that the user must copy and paste into a local file to see it in action.
  2. Instead, look into a MediaWiki extension or hosting the JavaScript code at a location that can't be edited by untrusted users but still could be linked to and run on this article page as a demonstration.
  3. Add static tables of the results for reference so the user doesn't have to go through the trouble of making their own copy and running it in multiple browsers.
  4. Some other options or combination of 1, 2, or 3.

I'll have to vote for at least choices 1. and 3. because the test code is useful (at least pedagogically) and a results table from current, popular browsers would be a useful reference for those considering this method of feature detection.

I'm new here so tell me if I should've put all these words into the mailing list instead or if I'm breaking protocol in any other way. Also, because I'm new, I have no idea concerning the viability of option 2 and I hope I didn't step on User:Mathieu Deaudelin or User:CitizenK's toes because they had this on their todo lists, however, I didn't see any activity for the past few months on this. -User:George3

You can file an upload request in bugzilla.m.o to get the example uploaded (product - MDC). This is a temporary solution until we have a MW extension or something that allows people submit examples more easily. Callek had a requirements doc for such extension --Nickolay 06:09, 6 September 2006 (PDT)
Future reference - MDC Upload Request link, Location to upload?: http://developer.mozilla.org/samples/domref/