www.webdeveloper.com
Results 1 to 7 of 7

Thread: need help making offline web app

  1. #1
    Join Date
    Feb 2013
    Posts
    3

    need help making offline web app

    Hello this is my first post and i want to make a web app for a scavenger hunt/game im organizing. This app is offline and needs to have a password for each hint. Is there a way to have a prompt show up asking for a password or something similar while remaining offline? it doesnt have to be too secure and the password could be in the code, i just want to know how to do it. Thank you

  2. #2
    Join Date
    Feb 2013
    Posts
    4
    bump

  3. #3
    Join Date
    Jul 2012
    Posts
    57
    Ok, I don't think you could do this with pure html, however if you can enable javascript in your app try this method: (I don't know javascript, but this should be similar to what you need)

    <script>
    function logincheck(form) {
    if(form.id.value=="user") {
    if(form.pass.value=="password") {
    location="yourdesiredpage"
    }
    else {
    alert("FAILED ATTEMPT!!! DESTROYING APPLICATION, FORCING PAYMENTS!!") //well don't say that lolz
    }
    }
    }

    /*
    *Now if you don't want username, just delete the first if statement and a closing }
    */
    </script>

    /*
    * This probably isnt write comment method (im a c++ guy), anyways,
    * the above should be near close to javascript I think. but what that does
    * is if the username is correct, then it will check password, if thats good
    * user will get redirected. If bad, user gets alerted. Now for the form
    */

    <form name="login">
    <input name="id" type="text"> </br>
    <input name="password" type="password"></br>
    <input type="button" value="Login" onClick="logincheck(this.form)">
    </form>

    /*
    * If that doesn't work, try puting value="" in the input names
    * Otherwise, it should be close or actually work. If you need
    * help enabling javascript on a platform where webapp is, let
    * me know and I can try to help you on that.
    */

  4. #4
    Join Date
    Feb 2013
    Posts
    3
    Thank you. After a bit of tweaking it pretty much worked. The one thing that didn't work so well though was the location="yourdesiredpage" I don't know why, but I can get it to navigate to any page once I use that. I know I'm suppose to Id my pages in HTML, but could someone explain how to use the location="x"

  5. #5
    Join Date
    Jul 2012
    Posts
    57
    the location=x would work like this..

    location="http://www.webdeveloper.com"

    Now you would get redirected to that page.. or if its local use file://index.extension

    Or you could try this method I found on w3schools...

    <script>
    function newDoc()
    {
    window.location.assign("http://www.w3schools.com")
    }
    </script>
    </head>
    <body>

    <input type="button" value="Load new document" onclick="newDoc()">



    More Explination here

  6. #6
    Join Date
    Feb 2013
    Posts
    3
    Thank you. I used the second method you showed me and I finally got everything set. Thanks again everyone

  7. #7
    Join Date
    Jul 2012
    Posts
    57
    no problem, glad I can help with barley any web experience (im more of a programmer guy)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles