For MediaWiki (recent comments | status changes | tags | authors | states | release notes | statistics)
var targetBaseUrl === currentBaseUrl, currentBaseUrl = window.location.href.split("#")[0]; // Compatibility with 1.17, 1.18 || mw.config.get( 'wgServer' ) + targetBaseUrl === currentBaseUrl + // Compatibility with protocol-relative URLs + || window.location.protocol + mw.config.get( 'wgServer' ) + targetBaseUrl === currentBaseUrl
Doesn't work as expected under 1.17wmf1 (ie. commons and others)
var targetBaseUrl = mw.util.wikiGetlink(data.redirect.pageName);
this is either /wiki/User:Foo (1.18+) or (http:)//example.org/wiki/User:Foo (1.17), which is why the first fallback prepending wgServer was added in r91853.
/wiki/User:Foo
now with the variable protocol (relative on wmf-production, non-relative in development and other 'normal' wikis), we need two, not one, extra fallback.
The following is also needed:
// Compatibility with protocol-relative URLs on 1.17 || window.location.protocol + targetBaseUrl === currentBaseUrl