Pages: [1]   Go Down
Send this topic | Print
Author Topic: How To: Stop Firefox Dual Pageloads  (Read 3105 times)
d3xt3r
Guest
« on: March 15, 2008, 04:04:48 PM »

Mozilla Firefox (Also Gecko Web Engine, powers multiple browsers), tends to pull pages in pieces from the server while error-checking code, and if it discovers a error, it may decide to download the entire page, render the error into the most readable format then re-download the entire page again, before displaying. This can cause a few issues.

1. PHP statistics counters will show 2 separate page loads for each page load.

2. When transferring page to page, if the error is present on all pages, the layout will flash to default white screen between each page load. Its very annoying for admins like myself with a dark background.


I discovered this issue with a some VERY small errors in my CSS Style Sheet. It caused the page to load twice every time. It would see the error half way processing, then re-render the page itself, presumably fixing the error, then re-download, and display. Played circles with my statistics, and white flashes between page changes.

Something good to note: Firefox by default, will load a page twice every time, if it is the first cache of the page. So, if you clear your browser cache, visit the site again, it will load twice that once until the cache is cleared, or overwritten.

Try these:

1. Verify all HTML Color Codes are prepended by # - E.G. "#ffffff" not "ffffff".
2. Verify all CSS Sheet parameters end with ; (Even though it may display properly. It may cause dual page loads.)
3. Verify any font parameters are specifically correct. E.G
Correct Font Code

Code:
.smalltext {color:#000000; font: bold 1px Verdana;}

Is Not The Same As (No Space Before "Bold"):

Code:
.smalltext {color:#000000; font:bold 1px Verdana;}

4. One very important issue that causes this. Make sure all CSS Background Image parameters are correct, or not present. Just deleting the image path, without removing the parameter, will cause the error in Firefox. I used to delete the image path, and leave the code for later use. But found this error was caused by that.

E.G. (This image path is non-existant, thus Firefox will read it as a error.)

Code:
body {background-image:url("");}


An efficient way to error-check all the code, is to use the Firefox built in Error Console, OR, remove pieces of the code in order, until the issue does not present itself, then find the error within the code that causes the dual loading.
« Last Edit: March 15, 2008, 04:57:38 PM by d3xt3r » Logged
fiate2000
Authority Member
****
Offline Offline

Posts: 682


WWW
« Reply #1 on: March 15, 2008, 04:12:45 PM »

[quote ]
Code:
.smalltext {color:#000000; font: bold 1px Verdana;}

Is Not The Same As (No Space Before "Bold"):

Code:
.smalltext {color:#000000; font:bold 1px Verdana;}
[/quote]

Interesting post. Which one is right? With space or without?
Logged

d3xt3r
Guest
« Reply #2 on: March 15, 2008, 04:52:13 PM »

Sorry, I should have been more clear about that one.. The one WITHOUT space is correct. =)
Logged
fiate2000
Authority Member
****
Offline Offline

Posts: 682


WWW
« Reply #3 on: March 15, 2008, 09:00:30 PM »

Thanks for clearing that.
Logged

islesv
Not Very Authoritative
Advanced Authority Member
*****
Offline Offline

Posts: 1016



WWW
« Reply #4 on: March 15, 2008, 10:53:31 PM »

Wow. A very enlightening post. You mean, you really had all the time to check out all of these? Smiley

EDIT: I am just wondering why this thread is titled a how to. Where's the how to part, or did I miss any thing?
Logged

d3xt3r
Guest
« Reply #5 on: March 16, 2008, 12:47:05 AM »

I guess I could have made it more clear (oops)

But it doesn't seem to be a big issue on 110mb.com but it has been elsewhere. Many people were trying to stop the issue, I guess its TIPS on stopping the dual page loading.. Kind of a HOW TO I suppose. =)
Logged
FrederikS
Member
*
Offline Offline

Posts: 1


« Reply #6 on: July 25, 2008, 06:34:03 PM »

Hi guys (+/girls),

I too had this error, and after some hours of debugging I found out, it was because of an empty src-attribute in an image-tag, e.g.

<img src="" alt="" />


In the end of my pageload, I was setting this value dynamically via javascript, which is why I didn't figure it out at first. But I hereby confirm, that at least firefox will reload the page (silently, though) if this "error" is present. The problem wasn't there in IE7, and I haven't tested other browsers.

Hope this helps somebody.

Regards,
Frederik Schøning
Logged
d3xt3r
Guest
« Reply #7 on: July 25, 2008, 11:46:08 PM »

Hi guys (+/girls),

I too had this error, and after some hours of debugging I found out, it was because of an empty src-attribute in an image-tag, e.g.

<img src="" alt="" />


In the end of my pageload, I was setting this value dynamically via javascript, which is why I didn't figure it out at first. But I hereby confirm, that at least firefox will reload the page (silently, though) if this "error" is present. The problem wasn't there in IE7, and I haven't tested other browsers.

Hope this helps somebody.

Regards,
Frederik Schøning

For clarity, were you using Script XHTML, or no compliance mode?

Do you use a DOCTYPE, etc? And do you pass the W3c Standards? Because, I don't seem to have the issue in Firefox 3.0.1 on D3xt3r.net using HTML 4.01 Transitional.. I am guessing you use XHTML based on your IMG tag closing.
Logged
Pages: [1]   Go Up
Send this topic | Print
Jump to: