Page MenuHomePhabricator

interwiki forwarding doesn't work for importScript()
Closed, DeclinedPublic


For example, here's a transcript from Firefox 24's Web Console on [[s:en:Help:Introduction]]:

[13:03:11.991] importScript('w:en:User:Jackmcbarn/advancedtemplatesandbox.js')
[13:03:12.029] [object HTMLScriptElement]
[13:03:12.225] GET [HTTP/1.1 301 Moved Permanently 156ms]
[13:03:12.728] GET [HTTP/1.1 403 Forbidden 203ms]

In English, what happened is:

  1. I ran "importScript('w:en:User:Jackmcbarn/advancedtemplatesandbox.js')"
  2. importScript() (correctly) tried to load the script from the URL
  3. tried to forward that to
  4. rejected the resulting request, reportedly because of something bad IE does with such URLs

If would forward to instead, this whole thing would actually work.

Version: unspecified
Severity: normal



Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 3:05 AM
bzimport set Reference to bz63381.
bzimport added a subscriber: Unknown Object (MLST).

Oh, I forgot to mention the motivation for this to work, which is that this syntax would be more convenient to add to ~/common.js than the calls to mw.loader.load() with gigantic URLs that we have to use now.

Found this crap myself trying to feed an interwiki prefix to importScript – see

Documented it because deemed that something broke down, but now found on that it’s not a bug but a security feature. It would be nice to see some developers (of both core and the importScript wrapper) at last.

Krinkle edited projects, added MediaWiki-ResourceLoader; removed MediaWiki-General.
Krinkle added a subscriber: Krinkle.

importScript() is only for local pages. This is by design and how it has always been. To reference scripts or gadget from other wikis, use mw.loader.load() with the full canonical title=...&action=..&ctype=... URL.