• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to refresh the main window once we close the popup

 
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a Page (Shopping Cart), in that page there is box showing cart items and prices. And also the same page contains one link which is pointing to completely different site(different context).

When the user clicks on that link, one popup window opens and going to that site. Once the user fills the form and submits, it goes to DB and updates the record and finally after we get the confirmation page on the popup, there is a close button on the popup which indicates to close that page.

Generally once we close the popup window it supposed to update the cart items and price, but it doesn't. When we refresh the page, the items are grabing from DB and displaying updated data.

Suppose if the popup window is with in the application, then we can refresh the page easily, but in this case its bit difficult to update page since pop is different site.

How can we do that?
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
window.opener.location.reload(true);
 
Simpson Kumar
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I know we need to place this line popup window's javascript, but here the popup window is a different context which we can't access to handle the jsp pages.

So how we can refresh the main page with that line?
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Web app contexts are moot. If there is a client-side relationship between the windows, Eric's approach will work. If there is not a relationship, there is nothing you can do.
 
Simpson Kumar
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Bear,

is there any alternate solution to my query? could you please let me know.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not until you explain why you need an alternate solution. Why does Eric's solution not meet your requirements?
 
Simpson Kumar
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I 100 % agree Eric's solution works, I already tested with related popup window.

You also told me that if there is no relationship, then that solution won't work. The reason why I asked you is there any alternative.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No. No relationship means no control.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you do not have control over the code in the external window (like opening a external site in the popup), then you can poll for the status of the popup window and do a self refresh when the popup window is closed.
From main window start a polling routine using setTimeout when the popup is opened, that checks for the popup window's state. If the popup window handle is closed or null then clear the timeout and perform the refresh.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Pradeep Palat wrote:then you can poll for the status of the popup window


If there is no relationship between the windows, this is not possible.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic