disabling Javascript - what effect?

As part of my on-going attempts to improve the slowness of Safari, the best fixes seem to center around Java (e.g. emptying Java caches) which I've read about and posted about elsewhere. In a similar situation, others have said they've disabled Javascript in Safari so I'm trying that now.

I did a bit of searching but I just don't get this so here's my basic question. I was wondering what effect that would have? Does someone know of a website where I could go and easily see the difference in functionality with javascript enabled and disabled?

(As for the effect on the speed of Safari - disabling javascript seems to help though the memory leak is still high).

thanks.

Posted on Sep 7, 2005 2:20 AM

Reply
20 replies

Sep 8, 2005 7:58 AM in response to CloitusDisruptus

What Works?

1) Switch javascript off in Safari's prefs
2) Clean the Java caches

Hello CD
I thought your synopsis was a very accurate summary of the particular problem that some of us have been experiencing. (And, I've noticed that we've both been accessing many of the same threads trying to fix this slow Safari problem and your earlier posts were very helpful.)

I think you may be right that the Memory Leak problem is not related to the slowness issue. I kept Safari on all night with a couple of windows open and by morning the memory usage was at 152MB and has increased to 178MB after about 20 minutes of web usage (but with no appreciable concurrent slow down in Safari).

However, this morning, though Safari is still running faster than it used to before the aforementioned 2 fixes, it is slowing down a slight bit - pages are taking longer to load, etc. And, this is not related to the type of pages that I was trying to go to. So I went into the Debug menu and had Safari pretend to be MSIE 6.0 and was back at the regular speed. When Safari pretends to be MSIE 6.0, I don't have to disable Javascript.

re: CD's point 5

Interesting observation. Perhaps that is why the other standard troubleshooting fixes (e.g. reset/empty cache/clear history from within Safari, disable autofill, clear icons cache & history.plist, remove dupl. fonts, running cron scripts) though useful, didn't solve this particular problem.

Fran -

I recently installed Little Snitch (about 10 days ago) and SafariSpeed (after the slowness problem was improved by clearing the java caches) but the slowness problems predate these by at least 6 months (but I didn't keep records to note when the problem actually started.) But prior to that there were no enhancements that I (knowingly) installed

Generally -
I too would like not to have to shut down Safari every night - as there are times when I want to keep everything as is and start again in the morning. However, unlike CD, I seem to still be having a slight slow down problem over time and I can't figure out what to do about that.

Sep 8, 2005 10:19 AM in response to Fran Corpier

Keep it in a little database with your comments, which should be logged before the test


A log - that is an excellent idea. (I'm just becoming proactive about maintenance so learning curve is steep right now.)

What should I include in this log?
Date/Time, Description, URL where problem occurring, Speedtest results (after othe info is filled in)?

I tried both those speedtest sites before in June 05 because of various connection problems (should have kept a log then!). We called our ISP, Comcast Cable, which replaced our modem.

Based on something I just did, I wonder if I'm using the correct terms to describe this "slowdown" problem?

1. After reading your post, I did a personal speedtest at www.bandwidthplace.com. Results: 6.1 megabits per second.

2. With Javascript disabled and Safari User Agent set as Automatically Chosen, on an unrelated matter, I went to MS Office2004, clicked on other products and then on Office v. X for Mac. The page seemed to be taking a while to load (I've been here before and it usually loads quicker).

3. I tried enabling javascript but still not loading quickly.

4. Then in Debug, I set User Agent as MSIE 6.0 and it loaded immediately.

5. Did another speed test- results: 5.5 Mps - yet this was after MSIE loaded the page quickly

6. About 15 minutes later, I did another speedtest - 4.5Mps - yet the pages I was going to did not feel slow to me even though the connection speed is decreasing.

So what I don't understand is the following; these speedtest sites will test my connection speed right? But is the connection speed right after a perceived slowing down going to tell me anything about how long it took to load a page immediately preceding the test? If Safari is getting hung up on something would that necessarily be reflected in a post-loading speed test? (Also aren't some of these decreases in internet connection speed due to factors such as traffic, etc.)

P.S. re: comparing a page w/Javascript enabled vs. disabled

I found one way of seeing the difference w/ and w/o JavaScript: For an unrelated matter, I went to Apple's QuickTime Download page and received the following notice "We cannot detect your computer's operating system (most likely because you have JavaScript disabled). Please select your download from the choices below:" I enabled JavaScript, refreshed the webpage and was taken to the download page for my OS. Based on what you and CD have said though, I guess I won't always be warned that I'm losing functionality from disabling javascript.

Sep 14, 2005 3:40 AM in response to Fran Corpier

Hi Fran,

Some good comments as usual, and 'fishing' for leads is of course welcome because even though I'm fairly convinced that this is not being caused by something 'tangible', rather a low level bug of some kind, you never know when something's been overlooked and it all makes sense later.

I've basically got this problem licked with javascript off (and on when needed) - Safari's still running on one launch: 19 days, which was the core of my issue with it really. This is perhaps slightly overkill but I'm really just seeing how long I can push it now! ;D

I feel I must clarify something though just in case you're wandering down the wrong path slightly; This is not a problem with javascript or sites using javascript per se, rather javascript appears to be the solution to the problem.
It's a problem that affects ALL browsing, not just sites using javascript. For instance, I first really noticed it using these boards on the unix forum which is a 'main site' of mine; a site that's always running and periodically updated. Now, this forum doesn't appear to use javascript, i.e. it looks and works identically with it on or off (there is mention in the source but I haven't noticed any effect - http://www.apple.com/main/js/scoderemote.js ). After a period of time has elapsed Safari exhibits this problem, no matter where one browses to - it just so happens that switching javascript off cures the problem - simple as that. So it's not a problem with it slowing down on some sites and not others, or just sites using javascript, it's a universal slow down (and it even starts to affect little things; window scrolling and the like - in fact, Safari as a whole becomes unusable).

If this hypothesis is indeed correct then I'm guessing the javascript implementation starts to struggle after a period of time has elapsed - switching it off removes it from the 'mix' and Safari is freed from the burden and works as it did from a fresh launch. Therefore, at this moment in time, I surmise that it's Apple's implementation of javascript that is somehow bugged and gets into trouble after it's been in use for some time. (Others suggest similar WebKit apps are affected which indicates it's not Safari itself that is bugged). I'll admit the other suggested fixes add more confusion to the arena though.

Of course, I haven't done any serious testing (perhaps like JNK is considering) - like just running Safari with nothing but a single Apple Discussions page for a week and see if the problem manifests itself regardless. For all I know there could be one site out there that causes javascript to spit the dummy for whatever reason and it's going unnoticed, impossible to tell without some stringent testing and serious time devoted to the problem.

Sep 16, 2005 2:03 AM in response to Thomas Evans3

hello TE3

I'm not sure if anyone has gotten back to you yet. (You may want to post your question as its own topic. I remember reading that it would then be more likely to be seen and responded to.)

There's a whole slew of troubleshooting fixes that I found searching the same issue on these Discussions boards and Apple's On-line support pages. I'll provide some links to the various threads that I've been looking at and you can do some searches and make your own decisions about these various options that have been offered. Some of the ideas, particularly in the beginning of the list are just initial fixes and as they didn't work for many of us experiencing this major slow down, we've been digging deeper into these Discussion pages.

From within Safari:
1. Empty caches
2. Clear Hisory
3. Reset (will lose many settings if you do this)
4. In preferences, uncheck the AutoFill categories (they can build up overtime).
5. Reset Cookies (you'll lose any settings that you'd like to have also).

6. Repair Permissions from Disk Utility
7. Resolve Font Duplicates (see following posts for more information: Kurt Lang's Font Problems and Bee's directions for Resolving font duplicates)
8. From User/Library/ - clear various caches or preferences
9. From User/Libary/Safari - clear favicons, trash history.plist
10. use general cleaning utilities such as Onyx, Cocktail, Tiger Cache Cleaner(although if your computer is new, it seems unlikely to have a backlog of old cache or log files, or corruputed preferences) - to clear caches (see XLabs Maintaining Mac OS X for information re: cache clearing and other ideas and tips. Other FAQs at X-labs may also be useful); check for corrupted preferences; run daily, weekly, & monthly Cron cleaning scripts, etc. (If you search these discussion pages you'll find out more about these maintenance tips and other harddrive/disk considerations that could troubleshoot slowness problems.)
11. Turn computer off at night.
12. in Tiger, look into disabling Widgets or finding out which ones are memory hogs - that can slow Safari down.
13. Do you have sufficient RAM and free memory (at least 10-15% of total should be available) - I've read posts where it's used up very quickly even on new computers - Bottom of a new finder window or Activity Monitor (user/applications/utilities) will tell you how much is still available.

14. As you read in CD's post above, unchecking Enable Javascript in Preferences-Security is part of a fix that along with clearing the java caches has been the only thing that has had a noticeable effect. It has not been part of the mainstream fixes that are usually recommended for slow Safari. For more on the Java and Javascript issues see Spacesuiter's posts. (BTW, Did you run Software Update - do you have all of the latest updates such as those relating to Java and Safari? and when you post your own topic on this problem, give more details About Your Computer.)

Like I said, I really had to dig around and try practically everything. And unlike CD who's had his computer running for almost 3 weeks now after clearning Java caches and disabling Javascript, mine will still slow down particularly as the memory leaks reach close to 200 MB but not nearly as badly as before. But definitely post your problem with more details in a separate post.

A list of links I've found useful will be in a second post.

Sep 18, 2005 4:08 AM in response to JNK

This solution is catching on -

Reading post Safari cannot connect to secure websites. Last post has link to a recent MacFixIt article Safari 2.0.1 (1.3.1 for Mac OS X 10.3.9) [#3] Slow/incomplete page loading; Solutions/Post-update procedure and the solution - clear java caches!

Because of fiasco with the Airport 4.2 Update, ended up upgrading to 10.4.2 earlier than expected. Computer is running quite well. I've left the computer on for almost 36 hours, using Safari today and had 10-15 pages open in Apple's Discussions and Support, numerous Word documents open and some other apps (Widgets have been removed from dock to prevent accidental opening) - my RAM usage at one point reached something like 940MB and I had over 4+GB of VM. At first JavaScript was disabled in Safari, then I had to enable it at which point memory usage went up from around 200MB to 240MB (400+MB VM).

On Activity Monitor, process kernel is up to 800MB VM - what is that? How/When do VM swap files get removed if you leave your computer running for days and days without restarting?

Sep 7, 2005 2:37 AM in response to JNK

Normally, when people turn JavaScript off, or counsel others to, it's NOT to gain speed; it's for some other reason.

On some sites JavaScript is merely used for rollover effect; but on advanced sites, JavaScript is used for a lot of important functions-- sometimes so important that you won't have full access to the site unless JavaScript is on.

The difference in speed with JS off, if any, should be so insignificant, that it begs the question: is one second or even a few worth the tradeoff in functionality.

That said, if you come across a site that does not work for you, turn JavaScript off and see if it works. Sometimes, some under-educated web site developer tests if your browser is IE or Netscape, and, if it's neither, then you might be locked out of submitting a form or accessing a page. In this instance, it's possible-- especially in the case of submitting a form-- that turning JavaScript off will get you passed the barrier.

Sep 7, 2005 2:49 AM in response to Fran Corpier

Normally, when people turn JavaScript off, or counsel others to, it's NOT to gain speed; it's for some other reason.


Interesting. I know that clearing the Java caches helped dramatically with the slowness problem for me and I don't know why disabling JavaScript has helped for others. (I've come across the idea quite a few times in the numerous threads here about slowness and memory leaks in safari and I didn't save all the post URLs so I don't know much more than that.)

The difference in speed with JS off, if any, should be so insignificant, that it begs the question: is one second or even a few worth the tradeoff in functionality. That said, if you come across a site that does not work for you, turn JavaScript off and see if it works


That's what I'm trying to figure out. I've now disabled javascript. I've poked around a few websites both searching for info on this issue and just to see if anything looks different. I haven't noticed any differences. Do you know of a website where I would easily notice the loss of functionality with javascript disabled? If I keep it disabled and come to a website where it is used for a lot of functions and I need it on for full access, will I receive some sort of notification of that from the website or otherwise notice that I don't have full access?

Sep 7, 2005 3:17 AM in response to JNK

Java caches have nothing to do with JavaScript-- they are two entirely different languages that are mutually exclusive, like Flash and JavaScript, or Perl and PHP.

A site may or may not clue you in to using or not using JavaScript. But advanced scripting is very prevalent on major sites; simply view the source code to see for yourself. Sometimes, to see the script source, you have to dig deeper and open the script's "src" URL. These sites use it for a reason: Interactivity!

JavaScript, to date, has been the major key to interactivity on the internet; and the best sites are interactive, as well as attuned to your browser and screen resolution; so that you get the best display possible.

Good luck with your research! 🙂

Sep 7, 2005 9:46 AM in response to JNK

Many people (including myself) seem to be suffering from an intense and extremely irritating slow-down problem with Safari. This is mainly characterised by a huge lag between doing anything, for example, clicking on a link in a page, and the actual action taking place. In this example the 'clicked' link goes red (as it does), but stays red for a long time, and then the beachball spins and the waiting begins. This waiting is small initially but then progressively climbs as time passes until it gets up into the tens of seconds to minutes long. That may not sound like much but in 'computer responsiveness time', it is an ice age and one that seriously impacts the usability of Safari! Other simple things like attempting to scroll the window produces the same effect - pause, spin, wait, curse, action (finally).

1) It takes a period of time for the problem to manifest - for me it always seems to be a few days.
2) After noticing the first signs of the problem, it continually gets worse and worse over time until Safari becomes utterly unusable.
3) Monitoring file system use (using lsof) shows nothing going on at that level, i.e. no caching to disk, or other unusual disk activity.
4) Processor use however goes through the roof for the period of waiting (like 80% or 160%+ with two processors).
5) Very important :- Any and all symptoms of the problem are completely removed via quitting Safari and then restarting it. (Note. this is of great importance because it hints that there is no problem with any of it's current support files, e.g. favicon caches, page caches, plist file, etc. - none of these things greatly change between quit and restart, i.e. they're still present and as they were two seconds later when Safari is relaunched, at which point it works perfectly again until the next time the problem begins...).

What Works?

1) Switch javascript off in Safari's prefs - I had occasion to try this during a particularly serious case of the slows...; BAM, instant dodge viper performance! - back to normal in fact, just like a fresh launch. Well, clearly the cause has been found...
2) Clean the Java caches - Others (including yourself JNK) have reported similar successes. (I've not confirmed this to myself as yet because I've been too busy enjoying a Safari that lasts over a day or two...)

So, there we have it, two clear winners on this weird issue. And whilst you're quite correct Fran that they're two different things, so far they share a strange similarity as successful 'solutions' (and also provide hints to the source of the problem).

JNK - It's not desperately bad with javascript off but what you will find is that you'll browse to some page somewhere and click on a link and nothing happens, you'll wonder what's going on, then you'll notice "run script()" or some such in the 'status bar' at the bottom of the window and the penny will drop: switch javascript back on and reload the page to get back full functionality. Sometimes a page won't look right at all, bit's missing, overlapped text, that sort of thing, again - switch it back on and reload. This switching on and off can be somewhat speeded up by using the associated keyboard shortcuts.

As for the memory leaks thing - I'm not convinced the two problems are related at all now, but using the above technique I've managed to have Safari running and usable non stop for 12 days now! Anyone want to know what the leaks are up to at this point?:
<pre><small>
Process 206: 3447558 nodes malloced for 500605 KB
Process 206: 52956 leaks for 2238128 total leaked bytes.
</small></pre>

Sep 7, 2005 7:58 PM in response to CloitusDisruptus

Curious: do you have any third party browser "enhancement" software running-- or maybe, any scripts that are constantly monitoring something?

I have not experienced these leaks or cpu problems and I'm almost constantly on the internet (professionally)-- but, then again, I habitually quit Safari and unplug the cable modem every night.

I guess that's one easy solution, rather than surfing without two of the web's interactivity building blocks.

Sep 8, 2005 4:36 AM in response to Fran Corpier

Hi Fran,

No, no 'enhancement' software, in fact I've long ago abandoned those sorts of apps, finding amusement and solutions in more and more of my own unix/cocoa/AS abilities (which aren't that much by the way, but what a collection of technologies!). Nothing's working with, or monitoring Safari that I'm aware of.

Actually, and most disconcerting, I think I've experienced this problem since 10.4.0 - clean fresh install on a clean drive as well.

Yes, if you quit Safari every night then I guess you won't ever see this problem. But that's at the root of it though, I don't want to have to quit it every night - often I have a few windows open with many tabs from research/reading/surfing/learning from the previous day that I don't want to have to lose on a quit, nor make temporary bookmarks of them all for obvious reasons. In fact it's a pain that shouldn't be there - Safari should be quite capable of running as long as any other app. (There may well be a compromise here via the use of Saft to save the browsing state on a quit...).

You're right - we need javascript - switching it off is indeed a poor 'solution' to this problem, but it's not an insurmountable situation to manage in the meantime. I haven't needed to mess with the java caches because it seems that switching off javascript is good enough, so it's just a question of being alert for those sites that need it on. I'm a lot calmer than I used to be, put it that way ;D

If you can handle it, it would be interesting for you to try it: leave it on at night and see how far you get. If security is a worry then perhaps make sure all 'services' you need are unchecked in sys prefs when you leave it to make sure all the ports in the firewall are closed, open them back up in the morning. You might even be able to disconnect the cable but leave Safari running. (Of course, no pressure if all this doesn't sound like a good idea!)

Kind regards.

Sep 8, 2005 8:10 AM in response to CloitusDisruptus

You know, "CD", I think I will try leaving Safari on for a time; because the more research that's done, the closer we are to knowing what's causing it.

After reading all of your postings on this subject, I realize why quitting Safari is not the ideal solution for you, as it may not be for many others; but for some who may read this topic, it's a perfectly reasonable solution, because they have no paramount reason to leave it on.

That said, may I ask? "Do you:
-- use dashboard widgets; or
-- have any flash thingy running or querying the internet (on your desktop probably)
because closures are used frequently in Action Scripts (based on ECMAScript/JS); or
-- frequent some sites that, as part of our research, you or others can monitor?"

The reason I ask, is because a technique called "Closures", specifically, in this instance, JavaScript Closures-- an advanced programming technique, can cause leaks, if they are improperly, or accidentally coded. There is a documented memory link in IE 4-6 that is proported to be due to bad garbage collection of circular references (caused by an ill-formed, or accidental closure). Here's a link to an article that describes this position.

This is something we might explore more, in the quest for the culprit.

Sep 8, 2005 8:22 AM in response to JNK

Are you keeping a log of this "slowdown" process, yet? JNK, I think I
really would, based on what you believe to be occurring.

Use a site like one of these:
-- http://www.bandwidthplace.com/speedtest/
-- http://www.dslreports.com/stest

... to test at different times; sometimes, when you think Safari seems
fast, and sometimes when it seems slow. Keep it in a little database
with your comments, which should be logged before the test, so you're
not coloring the results.

That log will also come in handy as you and others, here, start to hone
in on different sites and perhaps test some things, together, from
various machines. Additionally, it is something concrete that you can
submit to Apple to help them study the problem.

Sep 8, 2005 11:47 AM in response to JNK

There is a lot to respond to in your post 😉.

re: speed tests:
Yes, the speed tests are testing your connection speed and are affected by traffic on your (Comcast highspeed cable) network. They do it by downloading some code to your computer; they download a little more, then more, and more if your speed is apparently high, until they can interpolate the results. So, indeed, what they are downloading is quite different than content you are downloading on a site. But, nevertheless, it gives you a base, which should be an item (column) in your log.

About a year ago, I created companion js files that, when included in the download of any page, will give you the speed of that download. Of course I created it to test my own pages-- those, especially that were media-rich, wherein the total file size of the tested page was passed to my "SpeedCheck" function. You can get the total size of any page, using Safari's Activity link (under the Window menu), and adding up all of the sizes of the target page, if there's not already a total listed.

Here's what I'll do for those of us here wanting to run similar tests, independently. I'll gather the code, include it in a frameset with instructions, and load it to my .mac homepage, then post back the link-- if that appeals to you. It will probably be tomorrow before I'll post the link.

re: log record columns:
Besides the columns you listed, you'll want, of course a "Perception", column, where by which ever name it goes, you can describe "slow", "fast", or whatever consistent terms you decide to apply to your initial perception of Safari's performance before testing. Then add a "Comments" column where you can add notes. Play it by ear; you may well come up with more.

re: faster load emulating MSIE 6.0:
Yeah, I'm not convinced that the user agent emulations are right on; so I would not put a lot of stock in the fact that an emulation of MSIE 6 loaded a page faster-- it could be because it was already in cache, for example.

re: comparing a page with JavaScript enabled vs. disabled:
Most interactive sites use either browser detection (not so good) or feature sensing so that they can present you automatically with material that you'll see correctly; instead of asking you which you want to use, or giving you options that you may not fully understand-- which is a clumsy method of getting, hopefully, to the same place.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

disabling Javascript - what effect?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.