?
Solved

java script to redirect to a new page

Posted on 2013-11-25
12
Medium Priority
?
646 Views
Last Modified: 2014-01-02
I want to write an application to book a tennis court 5 at 6pm on every Wednesday .  Using the following script  I can logon to the membership page successfully, but how can I redirect to booking page,  Wednesday booking page and book the court 5 ?
thanks


   
<!doctype html>
    <html>
    <title>Tennis Sport Club Autologin</title>
    
    <body>

<form id="loginbox" action="https://engine.gigasports.com/VerifyLogin.asp" method="post" name="Logon">
    <select name="uni_url" id="logServer" class="validate[required]">
     </select>  
           
                Username <input type="text" size="12" name="txtUserID" id="txtUserID" value="username" >
                Password <input type="password" size="12" name="txtPassword" id="txtPassword" value="passowrd">
                <br />he
 </form>

  <script>document.forms['Logon'].submit();</script>      

 <script language="javascript" type="text/javascript">
      
     window.location.href="http://engine.gigasports.com/Booking.asp";
     
 </script>
          

  </body></html>

Open in new window

booking.jpg
logon.jpg
booking.txt
logon.txt
0
Comment
Question by:HemlockPrinters
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
12 Comments
 
LVL 30

Assisted Solution

by:Alexandre Simões
Alexandre Simões earned 1000 total points
ID: 39676878
This is best done with a browser automation tool like Selenium

Selenium also support to be launched from command line so you can set it as a windows task to be run everyday at a certain hour...
0
 
LVL 39

Accepted Solution

by:
Pratima Pharande earned 1000 total points
ID: 39676941
As per my understanding login page redirectling you to the VerifyLogin.asp
then you need to put javascript on VerifyLogin.asp page to redirect to boooking page

     
     window.location.href="http://engine.gigasports.com/Booking.asp";
0
 

Author Comment

by:HemlockPrinters
ID: 39685857
thanks. Login page redirected me to the verifylogin.asp.  How do I put java script on VerifyLogin.asp page?
0
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

 
LVL 15

Expert Comment

by:Insoftservice
ID: 39686457
As per your last comment you could put javascript on any page by using <script> tag.

 <script language="javascript" type="text/javascript">
 
    window.location.href="http://engine.gigasports.com/Booking.asp";
     
 </script>
0
 

Author Comment

by:HemlockPrinters
ID: 39690481
thanks insoftservice, I put javascript after submit the login form, but it doesn't open the booking page though.

---------------------------------------



<!doctype html>
    <html>
    <title>Tennis Sport Club Autologin</title>
   
    <body>

<form id="loginbox" action="https://engine.gigasports.com/VerifyLogin.asp" method="post" name="Logon">
    <select name="uni_url" id="logServer" class="validate[required]">
     </select>  
           
                Username <input type="text" size="12" name="txtUserID" id="txtUserID" value="username" >
                Password <input type="password" size="12" name="txtPassword" id="txtPassword" value="passowrd">
                <br />he
 </form>

  <script>document.forms['Logon'].submit();</script>      

 <script language="javascript" type="text/javascript">
     
     window.location.href="http://engine.gigasports.com/Booking.asp";
     
 </script>
         

  </body></html>
0
 
LVL 15

Expert Comment

by:Insoftservice
ID: 39692386
"Your session has expired.
Please log in again"

Are you getting that page.If yes then please pass on the session and parameters required for these page.
Stop the page before redirecting it to  "http://engine.gigasports.com/Security_SessionExpired.asp" so that it would be clear that you page has been redirected.
And to keep it on we have to pass the required data
0
 

Author Comment

by:HemlockPrinters
ID: 39696936
thanks Infoftservice, I got what you mean. but how to pass on the required session variables?
0
 
LVL 15

Expert Comment

by:Insoftservice
ID: 39697483
For such cases you have to take help of AJAX using some scripting language and then send such secure data using REST method like curl ,socket e.t.c
0
 
LVL 15

Expert Comment

by:Insoftservice
ID: 39751026
@Rob (tagit) how come my comments were not accepted . please check my all comments so as to get proper idea that client was able to redirect his page but later he got stuck in session which even i had suggested the way.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.
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)

801 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