Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jun 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Auto sign in without having to click on link? (VERY NEW to THIS)

    I really don't know what I am doing, but I need to know how to alter this script to load this website without having to click "Weathersentry online". I would like to double click on the icon the code is attached to and it sign in automatically. Can anyone help?

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Sample Signin link WeatherSentry Online</title>
    </head>

    <body>

    <form id="DTNSigninForm" action="http://weather.dtn.com/dtnweather/common/signin.do" style="margin: 0,0,0,0;" >
    <a onclick='document.getElementById("DTNSigninForm").submit();return false;' href="javascript:void(0);">WeatherSentry Online</a>
    <input type="hidden" name="username" value="username" />
    <input type="hidden" name="password" value="password" />
    <input type="hidden" name="autoLogin" value="true" />
    </form>

    </body>
    </html>

  • #2
    Senior Coder Dormilich's Avatar
    Join Date
    Jan 2010
    Location
    Behind the Wall
    Posts
    3,350
    Thanks
    13
    Thanked 349 Times in 345 Posts
    Code:
    <form id="DTNSigninForm" action="http://weather.dtn.com/dtnweather/common/signin.do" style="margin: 0,0,0,0;" >
    <input type="hidden" name="username" value="username" />
    <input type="hidden" name="password" value="password" />
    <input type="hidden" name="autoLogin" value="true" />
    </form>
    <script type="application/javascript">
    document.getElementById("DTNSigninForm").submit()
    </script>
    The computer is always right. The computer is always right. The computer is always right. Take it from someone who has programmed for over ten years: not once has the computational mechanism of the machine malfunctioned.
    André Behrens, NY Times Software Developer

  • #3
    Senior Coder tomws's Avatar
    Join Date
    Nov 2007
    Location
    Arkansas
    Posts
    2,644
    Thanks
    29
    Thanked 330 Times in 326 Posts
    I wonder if the onload event could handle that?

    Code:
    <body onload="document.getElementById("DTNSigninForm").submit();return false;">
    Or slop it up by dropping a script tag with the submit at the end, maybe.
    Code:
    <script type= text/javascript>
    document.getElementById("DTNSigninForm").submit();
    </script>
    </body>
    Are you a Help Vampire?

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    26,185
    Thanks
    80
    Thanked 4,453 Times in 4,418 Posts
    I'll bet it doesn't work, though.

    I'll bet that the weather.dtn.com site won't allow a <form> to be submitted from outside its domain. That's a very very fundamental security measure in most frameworks and the ".do" extension there says it's using one of the standard JSP frameworks, I think.

    So this code would only work if it was actually on a page on that same domain's site.

    Wanna bet?
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •