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
38 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 32

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article discusses how to create an extensible mechanism for linked drop downs.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now