Solved

Open New Window AND Redirect

Posted on 2014-01-10
7
967 Views
Last Modified: 2014-01-18
Hello Experts,

In Classic ASP, is it possible to open page1.asp in a new window (perhaps body onLoad=window.open('page1.asp', '_top') while load page2.asp in the parent window (perhaps Response.Redirect, or maybe I can add to my body onLoad)?

Thank you
0
Comment
Question by:APD_Toronto
  • 4
  • 3
7 Comments
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 39772872
It is possible in client side javascript.  But whichever page is the pop up would probably be silently blocked or an alert.  

What is it you are trying to ultimately achieve.  Typically, when there is a question like this there is a different way to do the same thing you have not though of.
0
 

Author Comment

by:APD_Toronto
ID: 39773646
It won't be blocked as it's an Intranet site.  All permissions granted to popups.

It's just after an order is processed, I need a popup with the order summary, while in the parent window, return the employee to the new order screen.
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 39773745
Pop ups are still not such a great idea.  They are hard to use.  Your choices are to


Option A Using all asp
1)  User on order.asp page and clicks a button to send order to order_process.asp
2) order_process.asp does all the work
3)  User sent to confirm.asp  (or combine with step2 and just use confirm.asp to do step 2
4) After confirm, send back to order.asp

Option B Using javascript/jquery ajax and an alert
1) User on order.asp page clicks a button
2) User stays on order.asp and sends an ajax request to order_process.asp
3) The status is returned from order_process and A Pop Up is created about the transaction.
4) User clicks out of Pop Up and is still on order.asp which refreshes and is ready for new


Option C Using javascript/jquery ajax with a pop up window
1) User on order.asp page clicks a button
2) User stays on order.asp and sends an ajax request to order_process.asp
3) The status is returned from order_process and an alert is created about the transaction.
4) User clicks button on pup up which closes and returns to order.asp.

Option D Using javascript/jquery ajax with a modal
1) User on order.asp page clicks a button
2) User stays on order.asp and sends an ajax request to order_process.asp
3) The status is returned from order_process and a modal is generated with the transaction.
4) User clicks out of modal and is still on order.asp which refreshes and is ready for new

Option D I think is  your best bet and will look good on mobile/tablet.  Option C is hardly ever used anymore and very difficult to maneuver.

Option D sample http://jsbin.com/EwOnILI/1/ and code
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery.min.js"></script>
<link href="http://getbootstrap.com/dist/css/bootstrap.css" rel="stylesheet" type="text/css" />
  
    <!-- Custom styles for this template -->
    <link href="http://getbootstrap.com/examples/jumbotron-narrow/jumbotron-narrow.css" rel="stylesheet">
  
<script src="http://getbootstrap.com/dist/js/bootstrap.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
   <div class="container">
      <div class="header">
        <ul class="nav nav-pills pull-right">
          <li class="active"><a href="#">Home</a></li>
          <li><a href="#">About</a></li>
          <li><a href="#">Contact</a></li>
        </ul>
        <h3 class="text-muted">Project name</h3>
      </div>

      <div class="jumbotron">
        <h1>Submit Your Order</h1>
        <p class="lead">Cras justo odio, dapibus ac facilisis in, egestas eget quam. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p>
        <div class="row">
        <input placeholder="Name">
        <input placeholder="Address">
        <input placeholder="Qty">
        <input placeholder="Product">
        </div>
        
        <p><a class="btn btn-lg btn-success" data-toggle="modal" data-target="#myModal">Submit Order</a></p>
      </div>

      <div class="row marketing">
        <div class="col-lg-6">
          <h4>Subheading</h4>
          <p>Donec id elit non mi porta gravida at eget metus. Maecenas faucibus mollis interdum.</p>

          <h4>Subheading</h4>
          <p>Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Cras mattis consectetur purus sit amet fermentum.</p>

          <h4>Subheading</h4>
          <p>Maecenas sed diam eget risus varius blandit sit amet non magna.</p>
        </div>

        <div class="col-lg-6">
          <h4>Subheading</h4>
          <p>Donec id elit non mi porta gravida at eget metus. Maecenas faucibus mollis interdum.</p>

        
        </div>
      </div>

      <div class="footer">
        <p>&copy; Company 2013</p>
      </div>
     
     
     <!-- modal -->
     
     <!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title" id="myModalLabel">Modal title</h4>
      </div>
      <div class="modal-body">
        You ordered a bunch of stuff.  Thank you!
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
     <!-- end modal -->

    </div> <!-- /container -->

</body>
</html>

Open in new window

0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

Author Comment

by:APD_Toronto
ID: 39773890
The order page is at domain A, which submits to orderProcess at domain B, which then goes to receipt.asp also at domain B.  

I need the popup to start at orderProcess so it has the same session as receipt.

While, after submission the parent window goes to order-list.asp.

Please don't school me on popups are bad and I need to rewrite my system, blah, blah, because my answer to that is my client is barely paying me minimum wage.  

As my original question, I just need to know how I can do a popup of pageA.asp, while at the same time go to pageB.asp in the parent window?
0
 
LVL 52

Accepted Solution

by:
Scott Fell,  EE MVE earned 500 total points
ID: 39773941
I understand.  

That sounds like we don't have to stay on domain A, right?  Just have the form action point to Domain B Process which triggers the pop up?

Just throwing out the idea of an iframe?

js popup window http://jsbin.com/aKebepI/1/
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body onload="myPopup2()">
  <script type="text/javascript">
<!--
function myPopup2() {
window.open( "http://www.google.com/", "myWindow", 
"status = 1, height = 300, width = 300, resizable = 0" )
}
//-->
</script>
  You should have a pop up when this loads
</body>
</html>

Open in new window

0
 

Author Comment

by:APD_Toronto
ID: 39773970
I will have some thought on the iFrame.

In the meanwhile, your code does the popup, but what about the subsequent re-direct? If it is to hard I may just do "click here to continue".
0
 

Author Closing Comment

by:APD_Toronto
ID: 39791130
Thanks, I ended up using an iFrame.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

760 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

15 Experts available now in Live!

Get 1:1 Help Now