Solved

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

Posted on 2015-01-30
6
58 Views
Last Modified: 2016-04-23
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
0
Comment
Question by:spraocs
6 Comments
 
LVL 10

Accepted Solution

by:
Jeffrey Dake earned 500 total points
ID: 40581128
I think attaching some JavaScript that replaced the onclick event might work, using window.open

http://www.w3schools.com/jsref/met_win_open.asp

Something like the following on the onclick event.

Window.open('recept page);
Window.open('home page', '_self');
Return false;
0
 
LVL 4

Expert Comment

by:Monika Bharti
ID: 40581159
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.
0
 
LVL 33

Expert Comment

by:Big Monty
ID: 40581658
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
0
 
LVL 16

Expert Comment

by:kiranvj
ID: 40582916
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
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question