Search This Blog

Tuesday, July 14, 2009

In HTML Reload Parent window from child window:

In HTML Reload Parent window from child window:

When I am working for a client, I have received one requirement.

Requirement IS:

Re-Load the parent window when ever clicking button in Child window.

Solution:

1. Consider two file called parent_window.html and child_window.html.

2. Open child window from parent window using javascript.

Window.open(“child_window.html”);

3. In child_window.html write javascript function called reloadParentWindow()

Function loadParentWindow()

{

If (opener)

Opener.location.reload();

}

You can call this function from child window.

function reloadParentWindow(){

//////this line of code will actually reload the parent window

if(opener)opener.location.reload();

}

Opener keyword returns the reference of the parent windows objects.

No comments:

Post a Comment