Twitch, time to fix/optimize your .js files

It doesn’t matter what browser I use, Twitch’s sucky .js files stall the flash plugin and eventually block the whole browser.

I’m using Kaspersky and I’ve looked for several fixes/tweaks. I found out it’s not an issue with KIS (Kaspersky Internet Security), but it’s an old problem with Twitch’s ancient .js files, heritage of justin.tv

I’ve ran malware scans, no problems, I’ve uninstalled & reinstalled Shockwave Flash two times already, same issue.

Currently tested on these browsers:

Chrome (tested with both the default internal version of Flash, and an external one…twitch window blocks all other opened tabs, I get this error and I’m left with nuking the chrome.exe from Processes)
Firefox (twitch window blocks for a bit, I get same error, but I can close the tab, not the browser entirely, although I cannot run anything that needs flash).
Safari & Maxthon (these browsers, based on IE, just show an empty spot on where the video window should be… Shockwave flash is installed and running, ActiveX is enabled, Compatibility view settings for twitch.tv are in place).

Take a look at those .js files that load up when a browser asks for stream details for the first time or for a recurring (logged-in) visit.

Even if cached on someone’s computer, every time the browser establishes connection to “stream X page”, it should not download the .js again, since it’s the same. Exception would be in case of cleared cache.

I leave you with this response from 2012. That .js file is relocated on another server and most likely renamed, but it is the main culprit in this whole ordeal.

Pls fix!

Our JS files aren’t causing any issues for me, nor most of our users as far as I can see. You’d have to be more specific with what part of our JS that Kaspersky doesn’t like.

If turning off Kaspersky allows the page to load, that implies the issue is Kaspersky’s fault.

First of all, turning KIS off is not an option for me, but I’ve tried it a couple of times, and the issue still remains.

And I knew this would turn into a game of “tag”:

KIS blaming Twitch, Twitch blaming KIS back.

The constant holds: with KIS off, all the browsers I tested on stall, the shockwave plugin becomes unresponsive and I have to restart the browser by killing the process.

“Most of our users” doesn’t imply “all” and I’m not a technical genius to figure out which part of the .js code interacts poorly with the browser.

Kaspersky only scans the .js file and its content, heuristically, in relation to their own virus signature db, and that doesn’t impact memory usage, etc.

Do I need to re-install “Live HTTP Headers” (in Chrome or Firefox) and run it everytime I open up twitch.tv? Or do I need to do a “Google Pagespeed” everytime I login on twitch?

Since I do website optimization, let me offer some insight:

https://developers.google.com/speed/pagespeed/insights/?url=http%3A%2F%2Fwww.twitch.tv%2Fpreparedwow&tab=desktop
(a random twitch channel I watch)

Since your .js files are unoptimized and chuncky, the browser is going to render said twitch page accordingly, delayed.

So, a fresh browser (with no logged-in user) needs to download all these & more, the first time it connects to a twitch stream:

GET /assets/application-97b0928ae3d518b9b7cb929fe5a3cc8d.css
GET /assets/emberhelper-32ec157ada293bef95ec60affec0e48f.js
GET /assets/global-55ee7ea68b322e7e05e03bef295fa3a1.js
GET /tmilibs/tmi-v3.js
GET //emberapp.js
GET /tag/js/gpt.js
GET /libs/mixpanel-2.2.min.js
GET /beacon.js?=
GET /ga.js
GET /api/viewer/info.json?on_site=1
GET /plugins/ga/inpage_linkid.js
GET /en_US/all.js
GET /stegtr/javascript.js?channel=
GET /steg/javascript.js?channel=
GET /preparedwow/related.json
GET /tmilibs/JSSocket.swf
GET /track?data={ giant code here }
GET /tmilibs/JSSocket.swf
GET /opt_content.js?v=opt

GET /js/companions.js?=
GET /tag/js/gpt.js?
=1426680671868
GET /api/viewer/token.json?as3=t
GET /gpt/pubads_impl_58.js
GET /api/viewer/info.json?as3=t
GET /quant.js
GET /assets/application-eadb1355ec0003cb3d3e1df9c9d5242c.js
GET /rtbcomponent.js
GET /assets/shared/login_form/index-c5840b2417ea803714708af637d9da31.js
GET /pp.js?owner=
GET /safeframe/1-0-2/html/container.html
GET /crossdomain.xml

Observation: Why do the assets js files are auto-generated with a new filename string everytime I refresh the twitch channel page?

Ok, so all these .js files have to do with log-in-out status, ad platform integration + ad sources, stream player library components, specific channel strings for featured content in the sidebar (filtered by game title, etc, promoted), 3rd party analytics + ad revenue analytics, tracking scripts, chat plugins and their custom rules (remember logged in user’s chat color, etc, modify chat options by user status: viewer, subscriber, administrator <-- various degrees of chat accessability).

I don’t care about Twitch’s methods of ads sharing, and I don’t care about the internal analytics scripts (cuz you sure ain’t running google analytics :D).

Focus on browser interaction (especially for first visit occurances), when the browser needs to download & render all those in a timely fashion.

On my end: all my browser automatically delete all temp & cache content as soon as I close them. I also run CCleaner from time to time…

So don’t fixate on “browser cache expiring date / maximum age”, but optimizing your files to infinity.

Double take that to the bank: it’s not Kaspersky’s fault! It’s like people giving advice on “deactivating the firewall”, hilarious! :smile:

I’m not trying to pass off blame to Kaspersky here, I apologize if I worded it poorly. What I’m trying to say is that you seem to have hit an obscure edge case where some combination of software/hardware on you computer (Browser? Extensions? Anti-Virus/Anti-Malware scanners? Flash player?) causes a catastrophic failure in the rendering of a Twitch stream page, and we need to first figure out what combination causes the failure (I assumed Kaspersky because you brought it up as a culprit) so that we can further debug it and find out WHY it happens.

JS files loading slowly should not lock up a browser, that behavior is fully expected and normal in a typical web browsing session. Likewise, it’s normal to rely on browser caching of files to speed up page load times, and the “new filename string” is a version number that changes when we update the contents of the file, so we can’t really optimize that.

Based on your report, every browser locks up when the flash player tries to load. What are the specs of your computer? What version of flash are you using? Are you running anti-virus/anti-malware other than kaspersky?

Again, “turn off your firewall” isn’t a permanent solution, it’s an attempt to find out what is causing the problem so that I can replicate it locally and fix it. “optimize your files to infinity” is not only extremely unlikely to happen, I’d also wager that it won’t solve your problem of flash crashing.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.