You are here -> Home > Developer Center > Refreshing a parent window from a child window in Javascript

Refreshing a parent window from a child window in Javascript
By: Jason Nowicki This article has been viewed 884 times.

   Sometimes in web development it would be nice to open a window with Javascript, enter some data, then close that window and refresh the parent window. Well, it took me a better part of a couple days to find a solution to this on the Internet.

opener.document.location.reload();self.close();

   When you open a new window in Javascript, the child window retains a reference to the parent. So to reference the parent you just need to append the word 'opener' to the beginning of the document object.

   Javascript is a very usefull language to learn if you do web development. Like any other language, it takes time to learn. However, if given the time it's well worth it.

 

How helpful was this article?