Javascript: window.open() problems
-
I have an HTML frameset page with 2 frames. In the left frame, I have a menu containing several buttons. For each button I have an "Onclick" event that calls the Javascript window.open() function. Basically, this function just loads the results of a Perl script (*.pl) into the right frame. For example, the button to add a customer calls: window.open("AddCustomerToDatabase.pl", "right frame"); I also have a "show all customers" button that loads another Perl script which will retrieve all customers from a database and display them in nice table on the screen. This script also loads into the right frame, replacing the existing content. The problem I have is that I notice that the window.open() function does not load a FRESH page. (Evidently, I dont see the IE status/progress bar at the bottom showing any activity). For example, first I click "show all customers" and I see a table with 4 customers. Then I click "add customer" which loads a form (into the same right frame) in which I fill out the new customer information, and then submit it. Then when I click "show all customers" again, I still see the same table with only 4 customers, and not 5. Only when I click IE's "refresh" button will the updated table be displayed. I am using MySQL database, and I am positive that the submitted customer info is updated in the database immediately when i clicked submit. (I have checked that). I find it weird that window.open() doesnt load a fresh page each time. It only loads a fresh page during that page's first load. Can someone suggest me a way to force a fresh load each time? I thought about using window.location = http://blahblahblah.pl, but then there is no way to specify the target frame. Please help. Thanks.
-
I have an HTML frameset page with 2 frames. In the left frame, I have a menu containing several buttons. For each button I have an "Onclick" event that calls the Javascript window.open() function. Basically, this function just loads the results of a Perl script (*.pl) into the right frame. For example, the button to add a customer calls: window.open("AddCustomerToDatabase.pl", "right frame"); I also have a "show all customers" button that loads another Perl script which will retrieve all customers from a database and display them in nice table on the screen. This script also loads into the right frame, replacing the existing content. The problem I have is that I notice that the window.open() function does not load a FRESH page. (Evidently, I dont see the IE status/progress bar at the bottom showing any activity). For example, first I click "show all customers" and I see a table with 4 customers. Then I click "add customer" which loads a form (into the same right frame) in which I fill out the new customer information, and then submit it. Then when I click "show all customers" again, I still see the same table with only 4 customers, and not 5. Only when I click IE's "refresh" button will the updated table be displayed. I am using MySQL database, and I am positive that the submitted customer info is updated in the database immediately when i clicked submit. (I have checked that). I find it weird that window.open() doesnt load a fresh page each time. It only loads a fresh page during that page's first load. Can someone suggest me a way to force a fresh load each time? I thought about using window.location = http://blahblahblah.pl, but then there is no way to specify the target frame. Please help. Thanks.
It sounds as if IE is caching the content from the first page displayed, and when subsequent actions request a page by the same name it serves up the cached copy, rather than generating a new one. I'm not sure how you would do so in a frameset, but try turning off caching, or expiring the display page immediately.
"The Lion shall lie down with the Lamb;
but the Lamb will not get much sleep..."
Lazarus Long -
I have an HTML frameset page with 2 frames. In the left frame, I have a menu containing several buttons. For each button I have an "Onclick" event that calls the Javascript window.open() function. Basically, this function just loads the results of a Perl script (*.pl) into the right frame. For example, the button to add a customer calls: window.open("AddCustomerToDatabase.pl", "right frame"); I also have a "show all customers" button that loads another Perl script which will retrieve all customers from a database and display them in nice table on the screen. This script also loads into the right frame, replacing the existing content. The problem I have is that I notice that the window.open() function does not load a FRESH page. (Evidently, I dont see the IE status/progress bar at the bottom showing any activity). For example, first I click "show all customers" and I see a table with 4 customers. Then I click "add customer" which loads a form (into the same right frame) in which I fill out the new customer information, and then submit it. Then when I click "show all customers" again, I still see the same table with only 4 customers, and not 5. Only when I click IE's "refresh" button will the updated table be displayed. I am using MySQL database, and I am positive that the submitted customer info is updated in the database immediately when i clicked submit. (I have checked that). I find it weird that window.open() doesnt load a fresh page each time. It only loads a fresh page during that page's first load. Can someone suggest me a way to force a fresh load each time? I thought about using window.location = http://blahblahblah.pl, but then there is no way to specify the target frame. Please help. Thanks.
You can append a unique parameter to the end of your query string to force the browser to load a new copy. This parameter will most likely be ignored by your script. Example:
// old call
// window.open("AddCustomerToDatabase.pl", "right frame");var cURL = "AddCustomerToDatabase.pl";
var dDate = new Date();
cURL += "&RandomNumber=" + dDate.valueOf();window.open(cURL, "right frame");
Although if working in an IE only environment, I prefer to call window.navigate() method of the frame that I want to load. Ex: window.parent.frames[1].navigate(cURL); onwards and upwards...
-
I have an HTML frameset page with 2 frames. In the left frame, I have a menu containing several buttons. For each button I have an "Onclick" event that calls the Javascript window.open() function. Basically, this function just loads the results of a Perl script (*.pl) into the right frame. For example, the button to add a customer calls: window.open("AddCustomerToDatabase.pl", "right frame"); I also have a "show all customers" button that loads another Perl script which will retrieve all customers from a database and display them in nice table on the screen. This script also loads into the right frame, replacing the existing content. The problem I have is that I notice that the window.open() function does not load a FRESH page. (Evidently, I dont see the IE status/progress bar at the bottom showing any activity). For example, first I click "show all customers" and I see a table with 4 customers. Then I click "add customer" which loads a form (into the same right frame) in which I fill out the new customer information, and then submit it. Then when I click "show all customers" again, I still see the same table with only 4 customers, and not 5. Only when I click IE's "refresh" button will the updated table be displayed. I am using MySQL database, and I am positive that the submitted customer info is updated in the database immediately when i clicked submit. (I have checked that). I find it weird that window.open() doesnt load a fresh page each time. It only loads a fresh page during that page's first load. Can someone suggest me a way to force a fresh load each time? I thought about using window.location = http://blahblahblah.pl, but then there is no way to specify the target frame. Please help. Thanks.