Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sun 19 May 2013, 17:06
All times are UTC - 4
 Forum index » Advanced Topics » Cutting edge
Fix waiting for (webpage) freezes and speed up browsing
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [7 Posts]  
Author Message
technosaurus


Joined: 18 May 2008
Posts: 3843

PostPosted: 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
View user's profile Send private message 
Bligh

Joined: 08 Jan 2006
Posts: 451
Location: California

PostPosted: 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
View user's profile Send private message 
greengeek

Joined: 20 Jul 2010
Posts: 1184
Location: New Zealand

PostPosted: 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
View user's profile Send private message 
Barkin


Joined: 12 Aug 2011
Posts: 463

PostPosted: 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
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 3843

PostPosted: 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
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 3843

PostPosted: 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
View user's profile Send private message 
Moose On The Loose


Joined: 24 Feb 2011
Posts: 278

PostPosted: 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
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [7 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Cutting edge
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0627s ][ Queries: 11 (0.0115s) ][ GZIP on ]