Topic on Project:Support desk

Javascript stopped working 1.17

20
Gboyers (talkcontribs)

Hi. On GrandTheftWiki, since upgrading to 1.17, our common.js has stopped loading into pages - no javascript is loading at all. This means no collapsible tables, analytics tracking or WikEd toolbar. We've made no relevant configuration changes, and userjs is off. I can't find any documentation on how to re-enable Javascript, and purging the common.js page had no effect.

Bryan (talkcontribs)
MaxSem (talkcontribs)

It loaded for me, your pages contain <script src="/load.php?debug=true&lang=en-gb&modules=site&only=scripts&skin=vector&version=20101105T185320Z"></script>, which loads Common.js So it probably just doesn't work properly.

Gboyers (talkcontribs)

That's the thing - everything worked before, and Common.js hasn't changed. Only the upgrade to v1.17 and ResourceLoader happened. I tried reverting to an older version of Common.js with no change.

Even though the script tag is there, and is correct, the JS does not run in the browser. I'm assuming there's a conflict somewhere.

It's not just Common.js that doesn't work - it's any javascript.

Examples of JavaScript no longer working are Preferences (no tabs), editing any page (no toolbar), and collabpsible tables (at the bottom).

An amount of CSS has also stopped working - including the diff colouring (for which I had to add some css myself to Common.css, which worked).

Catrope (talkcontribs)

In your wiki's HTML, I see:

<script src="http://www.grandtheftwiki.com/index.php?title=MediaWiki:Common.js&usemsgcache=yes&ctype=text/JavaScript"></script>

How did that get there? The URL MediaWiki outputs has text/javascript (in lowercase) and has &action=raw in it somewhere. If you added this to try to fix the bug, it only made it worse.

Also, which revision of 1.17 are you running? Your Special:Version won't tell me.

Gboyers (talkcontribs)

I added that line as an attempt to get some JavaScript to run, but it didn't help.

The issue was that debug mode was enabled, and disabling it made it both CSS and JS work again immediately.

70.68.162.184 (talkcontribs)

Just an addendum: I don't know why, but for some reason I had to set $wgResourceLoaderDebug to true to get JS and CSS working in the latest nightly build.

Krinkle (talkcontribs)

Do you mean with "not working" that you don't see how/where it is loaded or that the actual functions you have in Common.js don't work ?

Functions like LinkFA and hasClass (which you have in Common.js) work fine on your wiki when I try them from the javascript console.


PS: The "debug=false" in the link overrides $wgResourceLoaderDebug, that way you can test both without having to mess in LocalSettings.php

12.46.139.200 (talkcontribs)

uh. i still can't get this common.js to load. i tried disabling $wgResourceLoaderDebug and enabling, tried running debug to make some sense of what's causing it, but i'm having no luck.

MediaWiki 1.17.0 PHP 5.3.6 (cgi-fcgi) MySQL 5.0.24-community-nt

Gboyers (talkcontribs)

I found that there was an asterisk * appended to the <style> tag in the Vector skin, just before the closing quotes. With debug off, load.php serves up nothing (so we get no custom styles). With debug on, it works fine. Something fishy is going on.

12.46.139.200 (talkcontribs)

Gboyers - so the custom styles (and even scripts in Common.js) works with debug on in vector skin? could you tell me how to set the debug on?

Gboyers (talkcontribs)

In your LocalSettings.php you just need to add:

$wgResourceLoaderDebug = true;

141.58.148.209 (talkcontribs)

I can confirm this behavior. Mediawiki 1.17 with FCKEditor extension (which uses javascript) does only work with

$wgResourceLoaderDebug = true;

Apart from FCKEditor, this is a normal mediawiki installation without special modifications. The installation version was 1.13 or 1.14 and upgraded from 1.16 to 1.17 currently.

Krinkle (talkcontribs)

Could you clarify that, when you reported the problem, was the problem that you can't see where/how it's loaded or that the functionality inside is not loaded ?

ResourceLoader combines and minifies resources to save bandwidth http requests, enabling debug mode is, well, for debugging. Please elaborate on what the problem is, what goes wrong if you don't set "$wgResourceLoaderDebug = true;" ? By explaining that and allowing us to verify it it will enable the developer improve the software and fix the problems, right now your site is loading slower than it has to be because it's running in debug mode.

Gboyers (talkcontribs)

Sure. This is as far as I have got in the troubleshooting. For some reason, ALL of the load.php HTML style tags always have an asterisk at the end of the URL, as here:

<link rel="stylesheet" href="/load.php?debug=false&lang=en-gb&modules=mediawiki.legacy.commonPrint%2Cshared%7Cskins.vector&only=styles&skin=vector&*" />

For the load.php URL that loads Mediawiki:Vector.css, this was a problem. It seems that with debug=false, the URL (with the asterisk) provided null output. With debug=true, it provided the expected debug indented output. With the asterisk manually removed from the URL, it worked both times.

The effect this has was intermittent. On some page loads, the CSS would load, on others it wouldn't. I initially thought it was a timeout or 403 but enabling debug solved the problem and it all works all the time.

Again - I'm not 100% sure as to the cause, or if this applies to anyone else, but that's just the quick dirty fix that made it work for me.

18.111.58.13 (talkcontribs)

Did you get a resolution on this? I am having the same problem. For me, it is both JS and CSS files that seem to get the asterisk causing a 500 Server Error.

When I copy & paste the included URLs into their own window, I can reproduce this 500 error. But when I remove the asterisk from the URL, everything works fine.

If Krinkle's reply below is to be believed, then maybe it's a .htaccess problem?

Gboyers (talkcontribs)

I think it might have had something to do with our wiki farm setup, where I had been editing the apache includes. I changed back to using regular .htaccess and that seems to have sorted a number of issues.

Krinkle (talkcontribs)

The asterisk at the end is harmless and doesn't have anything to do with your issue. It's a security fix for old versions of Internet Explorer to avoid security problems. Catrope and Tim_Starling can tell you more about that.

  • Could you link to the url that is causing the null output ?
  • Have you removed the
    <script src="http://www.grandtheftwiki.com/index.php?title=MediaWiki:Common.js&usemsgcache=yes&ctype=text/JavaScript"></script>
    
    part from your install ? It's not supposed to be there and doesn't work.
Reply to "Javascript stopped working 1.17"