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
51 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
login jsp example 24 47
Converting dates in JavaScript 2 32
JQuery JavaScripot loop though RadioButtonList 4 25
CSS: Making Pure CSS read more boxes thinner 5 30
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

776 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