Page MenuHomePhabricator

Gadgets for anonymous users
Closed, DeclinedPublic


Currently, it doesn't seems to be possible for an anonymous user to enable any of the options (scripts and/or stylesheets) available through gadgets.

On English Wiktionary, there is the page wiktionary:Project:Per-browser preferences, which complements Gadgets extension and can be used by all users to turn on/off some additional JS/CSS features, even if they are not logged in. Such user preferences are stored in a browser cookie and need to be refreshed every 30 days.

I think the Gadgets extension should be enhanced in order to provide a better user experience for anonymous users in the same way which is currently done on English Wiktionary. Specifically, the extension would:

  • Continue to be as it currently is for logged in users;
  • Provide some page (e.g. Special:Gadgets, but with checkboxes) where unlogged users could have the chance to enable (or disable, since Bug 13742 was fixed) the tools which are available for logged in users. In this case, though, the preference would be browser-specific (as happens on Wiktionary).

Even if the user needs to refresh his preferences after some time of use (30 days), and every time they change of browser/computer, this approach seems to be a good improvement compared to the current situation.

Any thoughts?

See also

T18266: Gadgets extension should have the ability to disable gadgets with a URL parameter

Version: unspecified
Severity: enhancement
See Also:
T22151: Preferences for anonymous users



Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 11:27 PM
bzimport set Reference to bz29301.
bzimport added a subscriber: Unknown Object (MLST).

This would kill caching for anons, not acceptable from a performance point of view.

Something could be rigged up with cookies and localstorage and whatnot, but to date we tend to prefer that stuff like that goes in a user account's preferences; otherwise you lose all your preferences when you jump to another browser, and you still don't get any of the other account conveniences.

I don't know much about caching (almost nothing, indeed), but if we put something like

for (var i = 0; i < gadgetsList.lenght; i++) {
    if( $.cookie( gadgetsList[i].name ) == 1 ){
        mw.loader.load( 'ext.gadget.' + gadgetsList[i].name);

in an startup module for anonymous users, will it have caching issues?

(the cookies used above would be set once the user submit the changes to the checkboxes in a specific special page such as [[Special:Gadgets]])

What about this?

var gadgetsList = $.grep( mw.loader.getModuleNames(), function( module ){
    return module.substr(0,11) === 'ext.gadget.' && $.cookie( module ) === '1';
} );
mw.loader.load( gadgetsList );

Then a page could have buttons which when clicked would execute thinks such as this:

$.cookie( 'ext.gadget.HotCat', 1 );

As long as it isn't handled in the server output, it isn't a problem.

I'd recommend implementing this as an actual gadget. This is possible because as of a little while now, gadgets can be enabled by default as well as for anonymous users (not *by* anonymous users, though).

One comment though: Use a more elaborate cookie name.

  • Prefix with wgCookiePrefix
  • Include something like "anonModuleLoad" or something. So that it clear what the cookie is for.
He7d3r set Security to None.
He7d3r updated the task description. (Show Details)