javascript - Window.location not working I have tried eveything -
/*jslint plusplus: true*/ function signin() { 'use strict'; localstorage.setitem("index", 0); var get, sn, get1, text, i; = localstorage.getitem("login"); get1 = json.parse(get); sn = document.getelementbyid("studentnumber").value; if (sn === get1[0].student) { window.alert("welcome, " + get1[0].fname + get1[0].lname); window.location = 'newsfeed.html'; } else { window.alert = "sorry student number or password incorrect! did make account?"; } }
the window.location not working. page name right , program gives window.alert when information correct load new page. know why doesn't work? please help! i've been @ hours.
you opened html local filesystem. although seems work @ first glance, many features disabled security reasons. 1 of them might page redirect.
i suggest grab development webserver, , serve files through that. see express or connect nodejs, or following python:
- navigate root of webapp
- run
python -m http.server
python3, orpython -m simplehttpserver
python2 - open
http://localhost:8000
in browser
most javascript , html ide-s have builtin serving functionality too.
Comments
Post a Comment