| Author |
Message |
technosaurus

Joined: 18 May 2008 Posts: 3843
|
Posted: Fri 30 Nov 2012, 18:42 Post subject:
Fix waiting for (webpage) freezes and speed up browsing |
|
I don't know if I will have time to implement this, but I have been getting annoying behavior in all of my browsers "waiting for" ... including ajax.googleapis.com, platform.twitter.com, google-analytics.com, pagead2....
some of these I just don't need and I can add them to my /etc/hosts and redirect them to 127.0.0.1 (or 0.0.0.0) but others, like ajax.googleapis.com is needed by a ton of websites for jquery and other hosted js libraries. so I have the option to disable it and accept degraded or non-functioning sites or keep hitting reload every couple of minutes until it stops hiccuping.
I figured out a third option
A) run a small webserver
B) create a directory tree that mimicks the original hosts' including the needed files
C) use /etc/hosts to redirects offenders to 127.0.0.1
ex. put the latest jquery at:
$HOME/Web-Server/ajax/libs/jquery/1/jquery.min.js (+ symlink to jquery.js and symlinks to the /1/ directory for all known versions)
configure the webserver to either log or prompt the user for 404 not found errors, so that we can use it to locally precache them (this would involve temporarily enabling the sites for wget to download them to the appropriate locations)
any thoughts, anyone else get this problem, is it worth it just for the speed increase?
_________________ Puppy Web Desktop Now with pet packages - Pet Packaging 100 & 101
|
|
Back to top
|
|
 |
Bligh
Joined: 08 Jan 2006 Posts: 454 Location: California
|
Posted: Fri 30 Nov 2012, 20:22 Post subject:
|
|
I get that a lot on comcast cable. Particularly on older slower comps.
Not so much lately. on updated mozilla browsers.
Cheers
|
|
Back to top
|
|
 |
greengeek
Joined: 20 Jul 2010 Posts: 1184 Location: New Zealand
|
Posted: Sat 01 Dec 2012, 02:30 Post subject:
|
|
Sounds like a great idea to me. I get so sick of waiting for even simple websites to load, especially on older spec machines with less cpu and slower internet connections. (some of my machines are linked to the internet by IP wireless which is faster than dialup but nowhere near broadband speed).
Turning off flash helps a lot but all the google-analytics redirects etc seem like such a timewaster.
|
|
Back to top
|
|
 |
Barkin

Joined: 12 Aug 2011 Posts: 465
|
Posted: Sat 01 Dec 2012, 03:58 Post subject:
Re: Fix waiting for (webpage) freezes and speed up browsing |
|
| technosaurus wrote: | ... I have been getting annoying behavior in all of my browsers "waiting for" ... including ajax.googleapis.com, platform.twitter.com, google-analytics.com, pagead2....
some of these I just don't need and I can add them to my /etc/hosts and redirect them to 127.0.0.1 (or 0.0.0.0) but others, like ajax.googleapis.com is needed by a ton of websites for jquery and other hosted js libraries. so I have the option to disable it and accept degraded or non-functioning sites or keep hitting reload every couple of minutes until it stops hiccuping ... |
Using the Addons "NoScript" and "AddBlockPlus" in FireFox browser stops all that unwanted stuff. Whitelisting is a feature of NoScript: just permit the stuff you want rather than trying to blacklist everything you don't, (as in hosts).
Wildcards are permitted in AddBlockPlus filters so you can block a class of object rather than attempt to list every variant (as in hosts).
| technosaurus wrote: | | any thoughts, anyone else get this problem, is it worth it just for the speed increase? |
My browsing is much faster with NoScript and AddBlockPlus enabled, (in FireFox).
|
|
Back to top
|
|
 |
technosaurus

Joined: 18 May 2008 Posts: 3843
|
Posted: Sat 01 Dec 2012, 13:42 Post subject:
|
|
the waiting for ... is often a javascript library that is needed for the page to function properly - adblock, noscript or any other plugin can't magically fix that. I don't want to block them, just not freeze the page while waiting on them to (sometimes never) load. I need to redirect to another url that doesn't freeze, and still gets me the right resources. I _could_ run a paid service that would allow customers to redirect to a hosted website ... or I could write free software to host it locally. Honestly I wish bittorrent was integrated into browsers other than just opera and that javascript could use it for resources.
_________________ Puppy Web Desktop Now with pet packages - Pet Packaging 100 & 101
|
|
Back to top
|
|
 |
technosaurus

Joined: 18 May 2008 Posts: 3843
|
Posted: Fri 14 Dec 2012, 00:41 Post subject:
|
|
I've set up a basic web server for this purpose, it disregards the subdirectories and just loads the file from the current directory (so for instance you only need 1 jquery.js in 1 location and not a mess of directories for each CDN)
it probably still needs some work, specifically with /etc/hosts and/or /etc/nsswitch.conf, but it also means that it can be used as an ad blocker too:
/etc/hosts
127.0.0.1 localhost puppypc25346 #local machine = our webserver
127.0.0.1 ajax.googleapis.com #a domain we mirror locally
0.0.0.0 pagead2.googlesyndication.com #a site we want to block
The server (along with automatic downloader for missing files)
| Code: | #!/bin/sh
nc -ll -p 80 -e sh -c '
while read A B DUMMY
do
case "$A" in
[Gg][Ee][Tt])
FULL=$B
F=${FULL##*/}
F=${F%%\?*}
[ -f "$F" ] && cat "$F" && break
;;
[Hh][Oo][Ss][Tt]*)
[ -f "$F" ] && break
HOST=${B:0:$((${#B}-1))}
sed -i "s/hosts:\t\tfiles /hosts:\t\t/g" /etc/nsswitch.conf
wget -t 0 -q --no-dns-cache $HOST$FULL
sed -i "s/hosts:\t\t/hosts:\t\tfiles /g" /etc/nsswitch.conf
cat "$F"
break
;;
esac
done
' |
this would be much simpler without the wget part, but then I'd have to come up with a list of files to download (already started, but incomplete and need to verify licenses)
_________________ Puppy Web Desktop Now with pet packages - Pet Packaging 100 & 101
|
|
Back to top
|
|
 |
Moose On The Loose

Joined: 24 Feb 2011 Posts: 279
|
Posted: Fri 14 Dec 2012, 11:17 Post subject:
|
|
| technosaurus wrote: |
this would be much simpler without the wget part, but then I'd have to come up with a list of files to download (already started, but incomplete and need to verify licenses) |
I think it should stay with the "wget" and also publish the local web site for others on the local network to see. This way if you share a new work with someone who has a less modern OS, you can also make that machine use the local version for those files.
We could perhaps make a list that sort of grows organically. As the users use the system, each wget adds the name to the list of files that are to be downloaded the next time we do a fresh start on the web server.
The logic can just be to "grep" the file for the path already in it and then add it to the list if it isn't there. This way, it will cleanly recover from a file on the list being deleted.
|
|
Back to top
|
|
 |
|