Last modified: 2008-07-08 20:44:28 UTC
For writing userscripts (e.g. Greasemonkey scripts) it is essential for a script to detect if a page has been generated by MediaWiki software.
Currently there is no indicator, neither in the head section nor in the body code which under full control of the many different standard or custom skins.
I ran into this problem when I made the MediaWiki editor wikEd (http://en.wikipedia.org/wiki/User:Cacycle/wikEd) Greasemonkey compatible. Currently the program has to check the DOM for the fingerprints of many different skins. This causes problems with as yet unrecognized custom skins and changes.
Writing extensions would be much easier with a unique identifier for MediaWiki-served web pages. This identifier could be in the head section and could also include the version of the software.
What does this request mean?
(In reply to comment #1)
> What does this request mean?
From what I gather, the reported wants a meta tag, comment, or some other standardized fingerprint indicating an HTML page was generated by MediaWiki. Basically, we could have OutputPage add
<!-- Generated by MediaWiki version 1.11.0 -->
near the top of the output.
Yes, that's about what I was suggesting.
(In reply to comment #3)
>Therefore I would prefer a 'real' element such as meta, div,
> or span.
<meta> is probably best for this purpose.
WordPress does a <meta> like this:
<meta name="generator" content="WordPress 2.2.3" /> <!-- leave this for stats -->
Sound about right?
I'm a little leery of including version information, as we deliberately don't want that bulk-searchable as an obfuscation to make it harder for potential worms to find vulnerable versions of the software via search engines.
Brion: The version is already available on Special:Version - I have actually used this successfully to google for older installations. If there is an option to disable the version number on Special:Version, then use the same setting to disable it for the meta tag, but keep the "MediaWiki" string.
Special:Version is explicitly excluded from search by meta tag. That's a whole page, not an individual piece of the page which is aimed specifically at being searchable.
I do not think that you can use search engines to find information hidden in meta tags - and worms crawling for vulnerable versions can always access special:version.
Please could somebody take care of this. New and custom skins are constantly added to Wikipedia (e.g. Modern) as well as other sites and everytime scripts have to be manually updated because there is still no simple and reliable Mediawiki identifier on the pages.
Created attachment 4588 [details]
Adds a generator meta tag to the head of all MediaWiki pages
Please, could this be added as soon as possible. I can barely keep up with maintaining existing and writing new skin detections. If there are still objections about the version number, then please add at least the 'MediaWiki' part.
can't you simple check for a js variable or function that will always be there for mediawiki pages? wgPageName comes to mind. Even wgVersion exists.
And isn't the current skin even given in the variable aptly named skin?
No, I'm pretty sure it's there regardless:
(In reply to comment #16)
> See here for a MediaWiki 1.11.0 installation that does not generate the
> 1.11.1 change or have they disabled it somehow.
As there's nothing you can do about that and the suggested methods will work for all "normal" skins, I suggest that this bug be closed.
MW version is identifiable by both the wgVersion JS variable and the <meta> generator tag, closing as FIXED.