Click to See Complete Forum and Search --> : window.open() problems


lnong
07-03-2003, 04:07 PM
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.

karayan
07-03-2003, 06:15 PM
I'm not sure if this will work, but you may want to try

location.reload();

after you open the window. Because the URL is cached by the browser, the window.open() seems to default to the cached version. Maybe the reload() will force it to go and re-download.

Just a thought.

By the way, you can always specify the target frame by giving it a name (in the <frame> tag), and addressing it by name.

George