Link to home
Start Free TrialLog in
Avatar of spraocs
spraocs

asked on

Redirect to a new page and go to home page on the original page at the same time.

I have a transaction page which has a button to show receipt page. I need to show it in a new window. I am able to do it using target="_blank" in the redirect. However, I want to also go to home page from the original transaction page at the same time. I don't know how to do that. Any hints or help is very much appreciated. I prefer a classic ASP server side solution, However, I am open to HTML or javascript solution also if those exist.

Thanks
spraocs
ASKER CERTIFIED SOLUTION
Avatar of Jeffrey Dake
Jeffrey Dake
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Monika Bharti
Monika Bharti

Here is the code written using javascript, to redirect to a new page and go to home page.

$('#someButton').click(function() {
    window.location.href = '/some/new/page';
    return false;
});

Open in new window


OR you can use the id to take the user to home page and at  the same time the target blank will cause the url that you wanted to be opened in new tab.
another option is to go back to the home page first, then do a window.open(popUpPage.asp) on page load. if you need to open the pop up with some kind of dynamic data, save all of that data in a session variable (or cookie), then you can access it on the home page
Hi spraocs,

You solution with "target="_blank" will work for showing the receipt in a new window. But since you need to redirect the existing page to home page you need to have a JavaScript solution also.

Try this

<a href="receipt-page.html" target='_blank' onclick='window.location.href="homepage.html"'>Show receipt</a>

Open in new window


A sample html file attached. Change urls to your file names.

hope this helps,
kiranvj