I have a page generated by php which includes two drop-down lists (SELECTs) which contain a lot of items (about 2,000 each). The page is fine, but when it loads in Firefox, there's a delay during the load, and then it seems to refresh the entire page. If a user tries to click on anything before the "reload" occurs, it has no effect.
In Explorer, each drop-down just takes a while (a second or two) to appear, which is fine.
Anyone know what this is? And aside from using AJAX to dynamically fill the drop-down list, is there an easy way to avoid it?
EDIT: Additional information. I have got my PHP script to output to a log file whenever it is called, so I can now see that what seems to be happening is this:
A call is made to the PHP script, and the page starts to load. After a few seconds, another identical call is made to the PHP script, at which point the page starts to load again. This time it completes loading. So I guess it seems like the browser refreshes the page automatically for some reason before the page finishes loading.
Wild shot in the dark: Do you have any images or hidden image submit buttons with BLANK src? I needed to 'fake' a 'default enter' effect for a textbox and used a hidden image button before all the fields. Since it was hidden, I left the src attribute blank. Firefox loaded the page twice! Pointing the src attribute at a single-pixel but real image fixed it.
First, you should use a network sniffer like wireshark to confirm that the page really loads twice.
Then, confirm that it happens only with firefox;
Then, you are on the good way ! I experienced a variant of what n8wrl is proposing; it was in some css declarations with some empty background-image property --> Check your CSS for empty file declarations
Related
I have been using Custom extension for "Quick View" on every product like this
when hover the image, that link will show. when click that link, it will show with detailed description with big image. Its working well in product list page. But in home page, I got error like "TypeError: d is undefined" in img_height.js line no.7
I have checked that file and give alert for to find what value hold by d.I got an alert like [object object].(Multiple alerts were came).
d=Element.retrieve(a,"prototype_event_registry",$H()));
alert(d); //undefined d
var e=d.get(b);
Object.isUndefined(e)&&(e=[],d.set(b,e));
After closing alert boxes by check the checkbox "prevent this page from creating additional dialogs".
At that time, I got Error like "NS_ERROR_NOT_AVAILABLE: "
But I got alert box only in home page, Not in product list page. After giving alert, Quick Look working well in home page too. But if i remove alert, again i got same error "TypeError: d is undefined"
And also in between, I got most of the errors like "$.browser is undefined","typeerror $(...).live is not a function". I have fixed those issues by adding this script "<script src="http://code.jquery.com/jquery-migrate-1.0.0.js"></script>"
But i can't able to whats the real issue. This issue consumed around 3 days of my time. Still i didn't get any idea about why its happend like this.
If anybody have an idea, please save me guys.....
When this kind of thing happens to me it is either:
a) Because the product page is loading some extra scripts that aren't present on the home page. In this case, study the page source of the product page and check all the scripts that are loaded and all the inline scripts. Compare this to the page source for the home page being very careful to distinguish between different versions of jQuery and ensuring that jQuery is always .noConflict() so that Magento's prototype.js can own $. Maybe the home page has some other module that loads a different version of jQuery before or after your Quick Look scripts.
Or
b) Because some HTML element that the script needs is not present on the HTML page. So for example the product page might have a DOM element <div id="my-special-quick-look-box"> that the JavaScript will reference, but on the home page maybe this element is missing or in an unexpected ancestor-child relationship. Or, the div is present but the CSS means it has no height or is missing some property that the JavaScript is trying to reference.
Or
c) If all the JavaScript is combined into one file, it changes the running order and often some DOM element that will be there later is not there when the script is run. So if you have combined JavaScript take care over the running order and use the DOM events to know what has loaded when and then run the JavaScript at the right time.
That is my experience. Maybe it will help you find the bug.
I have a text file storing one string. I anticipate that the text file will be changing frequently, so in order to keep my page up to date, I would like to use PHP (preferably) to fetch data from the text file every 20 seconds so I can explode it into an array and use the contents accordingly. The variables would also need to update every 20s.
So: on page load, the contents are fetched and displayed. But the contents of the text file may be changed thus making the page outdated while a user may already have it open.
I tried META Refresh, but the whole page refreshes in the middle of browsing and interrupts the user.
Sorry for the confusing description, it's hard to explain. :)
I've searched the web for ages and not found an answer to my question. Please remember I am using a text file and not MySQL, since I'm only storing one string.
Thanks in advance.
If you want to stay with PHP, I'm afraid a refreshing HTML Meta is the solution :
<meta http-equiv="refresh" content="10; url=http://example.com/" />
Refresh the page every X seconds, so that the file gets reloaded.
Another way could be the use of frames, however I cannot seriously recommand it to you.
However, you can load a content without reloading the whole page, using Ajax. It allows you to perform a HTTP request to the server (using a Javascript code) and place its result on the current page, using Javascript as well. You could create a PHP script "my_string_parsed.php", which reads the file, and then parses/prints its content. Then, you could call this script through an Ajax request to http://yoursite.com/my_string_parsed.php, and place its result in a specified HTML tag on your page.
W3Schools.com provides an Ajax tutorial here : http://www.w3schools.com/ajax/
A warning concerning Ajax though : an Ajax content loading must never replace the typical HTTP behavior your browser and the server have. If the string in your file is the only content on your page, then the best solution would be the refreshing meta. Ajax should only be used to refresh parts of a page. Never the whole thing.
Why not using a database instead of a file. You could also use jQuery to update your page smoothly.
I have a flash banner working with xml and I want a control page for it. For example, when I change banner width from control page also banner change at the same time and same page without refresh. So that occur a preview for flash banner. PHP,HTML and banner available. But how can I get data from form instantly
if "instantly" means without refreshing the page, you need to search for AJAX.
here's a starting point for you:
http://net.tutsplus.com/tutorials/javascript-ajax/submit-a-form-without-page-refresh-using-jquery/
or, directly from flash:
Flash - AJAX call
You need to re-write the code with AJAX, modify all size-related properties for the swf. The script will monitor the form, and onChange (not onSubmit), read the values, remove the previous code and write a new one. I don't think that simply changing the values of the previous object will work on the fly.
I have a large section of code that I am using $('.data').prop('checked', false).button("refresh"); in to uncheck and refresh the jQuery UI styling on a group of checkboxes with data as their class. It works fine up until my code runs $("#div").load('output.php') which refreshes the output.php file. After this point, .prop('checked', false) works fine, but .button("refresh") stops working.
So what happens is the checkboxes keep unchecking properly, but the jQuery UI style doesn't refresh so they appear to stay checked even though they are not. Output.php is included on the page to start with, and I tried replacing the load with $("#div").load('text.txt') but it still stops working even if it is just loading the text file.
So it seems that .load() is breaking .button("refresh"). Any ideas what could be causing that or any potential solutions?
Is .data within #div? If so, the content of output.php will replace it, and the replaced elements will not carry the jQuery UI event data, as it was never bound to them.
The content that I was loading was html and had a <head> section. This was what was breaking .button("refresh"). I took what was in the head and included it in my main page's head and that solved the issue.
I have a very peculiar issue with Firefox and I've been unable to find out why. Basically I have a system where AJAX is used to submit data to PHP API, but when file uploads are used, then it will not use XMLHttpRequest() and instead falls back to submitting the form.
This is what happens:
Request is made for file upload
Javascript finds the form that is used for upload and assigns it to variable apiSubmitForm
Hidden iFrame is created with a random ID using DOM appendChild() method inside the and is assigned to variable hiddenWindow
apiSubmitForm method is changed to POST, action is changed to API URL, enctype is changed to 'multipart/form-data' and target is changed to the ID of the hiddenWindow
hiddenWindow will have an onload() method set, which includes resetting the apiSubmitForm values to what they were in the beginning and also removing the created hiddenWindow in the end of onload().
Now, everything works. There are no JavaScript errors. Data gets submitted and I can actually submit data many times in a row without problems.
But the green and spinning loading wheel on Firefox stays on as it does so. I'm assuming that it is called to close itself after onload event as well, except since hiddenWindow gets deleted in the end of it, it does not work?
This does not happen if I comment out this line from iFrame's onload event:
apiSubmitForm.removeChild(hiddenWindow);
Every other browser (Chrome, Opera, Safari and Internet Explorer) that I tested will not have that loading wheel running. And every browser (Firefox included) works correctly, form gets properly submitted and every other part of the code works as expected.
Is there anything I can do to close the window better? I cannot call that method right after apiSubmitForm.submit() either because that form submit is 'asynchronous' and it would break the loading.
Thanks!
Well, this is the closest I have gotten, it is a complete hack though:
setTimeout(function(){apiSubmitForm.removeChild(hiddenWindow);},1);
(Place this in the iFrame onload event)