The definitive answer can be queried from the SiteMatrix API:
https://meta.wikimedia.org/w/api.php?format=jsonfm&action=sitematrix&formatversion=2
Wikimedia wikis without SUL are marked with one of "nonglobal": true
,"private": true
, or "fishbowl": true
.
If you merely need to know if you’re on a WMF wiki vs a third-party wiki, then a simple regex might be easiest. For exampe, based on WikimediaDebug/manifest.json:
var rWMF = /(^|\.)(mediawiki|wikidata|wikibooks|wikimedia|wikinews|wikipedia|wikiquote|wikisource|wikiversity|wikivoyage|wiktionary).org$/;
if (rWMF.test(location.host))
console.log('Yes');
else
console.log('No');
But if you’re looking for something onofficial that’s more specific to SUL, then what you started with actually seems fine. Note though that the dns-prefetch
is from CentralNotice, not CentralAuth.
The current wmf-config shows that it is fine to assume any CentralNotice wiki also has CentralAuth. But there are a few rarer cases where CA is enabled without CN, so you’d miss those:
'wmgUseCentralNotice' => [
'default' => true,
'private' => false,
'fishbowl' => false,
'nonglobal' => false,
'advisorywiki' => false,
'lockeddown' => false,
'fiwikimedia' => false,
'qualitywiki' => false,
],
'wmgUseCentralAuth' => [
'default' => true,
'private' => false,
'fishbowl' => false,
'nonglobal' => false,
],
Example check (querySelector returns null|HTMLElement
, casted to false/true):
var isWmfCa = !!document.querySelector('link[rel=dns-prefetch][href*="meta.wikimedia.org"]');