Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:18
menu bandwidth usage
Poster: Mailman
Dated: Thursday July 22 2004 - 1:38:50 BST
I've noticed this menu uses up a considerable amount of bandwidth. I've been able to reduce the bandwidth usage quite a bit by renaming the menu files to filename.js.php and adding the following to the top of each file:
<? ob_start("ob_gzhandler"); header("Content-type: application/x-javascript"); ?>
This makes every script a PHP file. The code gzips the text before sending to the web browser, but only if the browser supports gzipped pages, which most do.
Still, after this compression the menu still uses up quite a bit of bandwidth. It would be nice if there were a "lite" version that had smaller file sizes.
Poster: Maz
Dated: Thursday July 22 2004 - 3:42:00 BST
You can compress the menu-data file, leaving no spaces. You can rename it menu-data.php, the thing that takes time is usually images not the menu, and those can be preloaded and are cached, and if the images are the same image used throughout then that helps cut down on loading images.
I find the menus quite fast loading, but then it may depend how complex you are building it. Older browsers don't handle js well will of course not be as fast, but modern browsers are faster.
maz
Poster: Mailman
Dated: Thursday July 22 2004 - 4:27:17 BST
Its not the speed of the menu loading that I have problems with, its the fact that the menu files use up almost 900MBs of bandwidth a month. We also use no images in the menu. Its the actual script files that are eating up bandwidth.
Poster: John
Dated: Thursday July 22 2004 - 4:36:02 BST
Haven't seen this problem myself, and I have sites of 500+ pages to deal with.
I don't think you're saving anything by zipping stuff. In fact, it seems to me you're putting an extra load on the server.
Any of your pages in an https environment?
Poster: Andy
Dated: Thursday July 22 2004 - 10:29:52 BST
This question/complaint comes up from time to time and it's so easy to blame the menu for the increase in bandwidth but you've missed the real reason.
The menu files are quite small really and the vast majority of users will have caching switched on in their browsers so the files will only be downloaded once per user per visit, on average 50-60K per website, that's nothing is it?
Think about what you have done by installing a menu system on your website. You've increased your websites ability to serve its pages. Check your logs a little closer and you'll see that you are serving more pages than before (I'll put a bet on it) and this is why your bandwidth usage has increased it's nothing to do with the size of the menu.js files but more to do with the fact that your website is easier to navigate and people are using it more now.
In theory, the menu should be getting much praise for making your website better but alas, we only get complaints. It's Kind of a victim of its own success.
Cheers
Andy
Poster: Mailman
Dated: Thursday July 29 2004 - 1:28:21 BST
You know, making the js files into PHP files is probably forcing the browser to reload the script every time someone visits a page, defeating the purpose of compressing it. I bet if I added some cache control to the script, I could have the best of both worlds: fast loading and low bandwidth usage.
Thanks for the replies.