<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://70.231.62.181/index.php?action=history&amp;feed=atom&amp;title=Template%3AInstall_user_script%2Fdoc</id>
	<title>Template:Install user script/doc - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://70.231.62.181/index.php?action=history&amp;feed=atom&amp;title=Template%3AInstall_user_script%2Fdoc"/>
	<link rel="alternate" type="text/html" href="http://70.231.62.181/index.php?title=Template:Install_user_script/doc&amp;action=history"/>
	<updated>2026-04-21T20:15:33Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>http://70.231.62.181/index.php?title=Template:Install_user_script/doc&amp;diff=17214125&amp;oldid=prev</id>
		<title>imported&gt;Daask: In section &quot;importScript() is not deprecated&quot;, link from &quot;some confusion&quot; to User talk:Enterprisey/script-installer#Confusing history of importScript</title>
		<link rel="alternate" type="text/html" href="http://70.231.62.181/index.php?title=Template:Install_user_script/doc&amp;diff=17214125&amp;oldid=prev"/>
		<updated>2024-07-29T03:38:08Z</updated>

		<summary type="html">&lt;p&gt;In section &amp;quot;importScript() is not deprecated&amp;quot;, link from &amp;quot;some confusion&amp;quot; to &lt;a href=&quot;/index.php/User_talk:Enterprisey/script-installer#Confusing_history_of_importScript&quot; title=&quot;User talk:Enterprisey/script-installer&quot;&gt;User talk:Enterprisey/script-installer#Confusing history of importScript&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Documentation subpage}}{{template shortcuts|iusc}}&lt;br /&gt;
{{Subst only|auto=yes}}&lt;br /&gt;
&amp;lt;!-- Categories go at the bottom of this page and interwikis go in Wikidata. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This template is used to install [[WP:US|user scripts]] that reside on the English Wikipedia. It is to be used primarily on [[Special:MyPage/common.js]] or [[Special:MyPage/skin.js]]. It adds the necessary &amp;lt;code&amp;gt;importScript&amp;lt;/code&amp;gt; line along with a [[WP:Backlink|backlink]].&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
In order to install a user script for your Wikipedia account, add the following line to [[Special:MyPage/common.js]] or [[Special:MyPage/skin.js]]: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{subst:iusc|script_path}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
*Replace &amp;lt;code&amp;gt;script_path&amp;lt;/code&amp;gt; with the full .js page name of the user script to be installed.&lt;br /&gt;
*The template &amp;#039;&amp;#039;&amp;#039;must&amp;#039;&amp;#039;&amp;#039; be [[WP:SUBST|substituted]] (&amp;lt;code&amp;gt;subst:&amp;lt;/code&amp;gt;), or else it won&amp;#039;t work.&lt;br /&gt;
*[[WP:BYPASS|Bypass your cache]] after saving the page.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{subst:iusc|User:TheDJ/sharebox.js}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Produces:&amp;#039;&amp;#039;&amp;#039; &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;importScript( &amp;#039;User:TheDJ/sharebox.js&amp;#039; ); // Backlink: [[User:TheDJ/sharebox.js]]&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== importScript() is not deprecated ==&lt;br /&gt;
&lt;br /&gt;
There is [[User talk:Enterprisey/script-installer#Confusing history of importScript|some confusion]] about whether or not importScript() is deprecated. The answer is that it is &amp;#039;&amp;#039;&amp;#039;not&amp;#039;&amp;#039;&amp;#039; deprecated.&lt;br /&gt;
&lt;br /&gt;
In 2015, importScript() was [[gerrit:c/mediawiki/core/+/203293|deprecated for one week]], and then [[gerrit:c/mediawiki/core/+/206078/|the action was reversed]]. In 2022, a [[gerrit:c/mediawiki/core/+/820828|bug causing importScript() to not work for mobile users]] was fixed. As of 2022, the latest statement by software engineers on the deprecation is [[phab:T27845#8135189]], which states {{TQ|For local imports, call importScript(). This is not, and never was, deprecated. For cross-wiki and other less trivial use cases, call mw.loader.load().}}&lt;br /&gt;
&lt;br /&gt;
In conclusion, importScript() is not deprecated, and editors should feel free to use it. It does not need to be systematically replaced by mw.loader.load(), and {{T|iusc}} does not need to be replaced with {{T|lusc}}.&lt;br /&gt;
&lt;br /&gt;
== importScript() vs mw.loader.load() ==&lt;br /&gt;
{{T|Install user script}} uses importScript(), and {{T|Load user script}} uses mw.loader.load().&lt;br /&gt;
&lt;br /&gt;
importScript():&lt;br /&gt;
&lt;br /&gt;
* Is less verbose, only needing the string of the page you&amp;#039;re loading.&lt;br /&gt;
* Is more restrictive, only allowing the loading of Wikipedia pages in the user or MediaWiki namespaces.&lt;br /&gt;
* Can load from other Wikimedia wikis, using a prefix such as &amp;quot;c&amp;quot; for &amp;quot;commons&amp;quot;. For example, &amp;lt;code&amp;gt;importScript(&amp;#039;c:User:YourName/test.js&amp;#039;);&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;#039;&amp;#039;&amp;#039;However&amp;#039;&amp;#039;&amp;#039;, this usage is not recommended as it involves an extra round trip. mw.loader.load is faster for cross-wiki loads.&lt;br /&gt;
* Makes your common.js file more readable, since it is less verbose.&lt;br /&gt;
&lt;br /&gt;
mw.loader.load():&lt;br /&gt;
&lt;br /&gt;
* Is more verbose, needing a long URL string. Note that the URL string has to be correctly escaped.&lt;br /&gt;
* Is less restrictive. Will load any URL from anywhere. So for example is good for loading from a local dev environment such as localhost.&lt;br /&gt;
* Can load from other Wikimedia wikis by adjusting the URL.&lt;br /&gt;
* Makes your common.js file less readable, since it is more verbose.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* {{tl|Load user script}} ({{tl|Lusc}}) – Version of this script that uses the &amp;lt;code&amp;gt;mw.loader.load()&amp;lt;/code&amp;gt; method.&lt;br /&gt;
{{Wikipedia:User scripts/Navbox}}&lt;br /&gt;
&amp;lt;includeonly&amp;gt;{{Sandbox other||&lt;br /&gt;
[[Category:Wikipedia JavaScript templates]]&lt;br /&gt;
[[Category:Wikipedia scripts]]&lt;br /&gt;
[[Category:Wikipedia user script templates]]&lt;br /&gt;
}}&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>imported&gt;Daask</name></author>
	</entry>
</feed>