Last modified: 2012-08-24 16:08:22 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T41620, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 39620 - JavaScript doesn't work on some special pages
JavaScript doesn't work on some special pages
Status: RESOLVED INVALID
Product: MediaWiki
Classification: Unclassified
JavaScript (Other open bugs)
1.19
All All
: Unprioritized normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-08-24 15:07 UTC by Steve
Modified: 2012-08-24 16:08 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Broken JavaScript (59.67 KB, image/png)
2012-08-24 15:07 UTC, Steve
Details

Description Steve 2012-08-24 15:07:59 UTC
Created attachment 10996 [details]
Broken JavaScript

See the attached image. On all normal wiki pages, we have a sidebar which uses JavaScript to expand into multiple menus. On some pages such as Special:Preferences and Special:UserLogin, the extended menus do not work. Examples are below:

Works - http://www.khwiki.net/Main_Page
Works - http://www.khwiki.net/Special:RecentChanges
Does not work - http://www.khwiki.net/Special:UserLogin
Does not work - http://www.khwiki.net/Special:Preferences

So there is something different about these pages which breaks the JavaScript menu.
Comment 1 Platonides 2012-08-24 15:12:08 UTC
Where is that javascript defined?

UserLogin and Preferences page explicitely disable some javascript, so that a malicious javascript can't steal your password or copy/change your email address.
Comment 2 Steve 2012-08-24 15:13:19 UTC
It's defined in MediaWiki:Monobook.js.
Comment 3 Krinkle 2012-08-24 16:08:22 UTC
Quick answer:

1) Don't use javascript as the only means to access a menu bar. It should fall back to a simple  html/css nested list and using javascript/css to trigger the dynamic menus only when javascript is ran. Had you done that, then at least it wouldn't be broken, just not interactive.

2) Don't use site scripts for layout. Site and user scripts are not allowed to run on SpecialLogin and other sensitive pages. If you want that, it means you're either doing something you shouldn't or doing it in the wrong place. If you are the site administrator and have access to the server, please implement this as a skin (e.g. make your own skin in /mediawiki/skins/<yourskin> next to "monobook" and "nostalgia" etc.). Do not hack stuff into Monobook, and certainly not in MediaWiki:Monobook.js.

Closing as "invalid" since it isn't a bug, this is the expected behavior. It is perfectly possible to have a interactive sidebar that is enabled on all pages, but it has to be ran from the server-side not from within the wiki through MediaWiki:Monobook.js because that script is only allowed to run on non-sensitive pages and shouldn't do anything with components that are visible everywhere (because that would make it inconsistent as it would only be visible on some pages).

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links