Wednesday, September 30, 2009

JavaScript : Close pop-up window and redirect to parent page

:target => adds the html attribute target to the link. This opens up a new window and names the new window the target.

You have to use javascript or Ajax to redirect the old page,

window.opener.location.href="http://new_url";

and then close the old window.

window.close();

This can be done either through the rjs file or directly in the javascript.

1 comment:

  1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Front end developer learn from Javascript Training in Chennai . or learn thru JavaScript Online Training in India. Nowadays JavaScript has tons of job opportunities on various vertical industry. JavaScript Training in Chennai

    ReplyDelete