How to reset the js script using location.reload() | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to reset the js script using location.reload()

I have a reload button which i want it to actually reload the entire script I know i could just create an finish function to just call the Start function to just repeat the process,but i liked location.reload which just reloads the page better so I tried it and well it doesnt work on sololearns mobile browser it just showed a blank page,How to reload a page or js in sololearns browser

17th Nov 2017, 5:48 AM
MohanPierce
MohanPierce - avatar
10 Answers
+ 5
What happens on a reload? It may help to look up Google bugs for this issue, then bugs that are introduced when you try to enable it.. Refreshing the browser and forcing a full new DOM + the server to open new sessions because there's no state tracking is actually relying on ancient internet servers behavior (before AJAX, sockets, SPDY/QUIC, etc). Keeping state and resetting what you need to without round-tripping the connection is newer.
14th Jan 2018, 6:36 PM
Kirk Schafer
Kirk Schafer - avatar
+ 5
Think immersive apps with in-game status updates. White-page reloads (or worse, timeouts crashing to a default browser error) disrupt that experience. :)
14th Jan 2018, 6:48 PM
Kirk Schafer
Kirk Schafer - avatar
+ 3
I Got around this Problem by the Ancient way By reseting all my variables etc and just recalling the main function again
14th Jan 2018, 2:11 PM
MohanPierce
MohanPierce - avatar
+ 2
It's disabled here (otherwise it would spawn a browser, which would be confusing)
17th Nov 2017, 6:20 AM
Kirk Schafer
Kirk Schafer - avatar
+ 2
I did it on my code memo.... I had many difficulties but now it is okay... this concept force yourself to mind a lot and it was a very good exercise for me finally...
25th Jan 2018, 5:36 PM
Jean-Philippe Czs
Jean-Philippe Czs - avatar
+ 1
my code works perfect In pcs where location.reload is supported,I dont know y mobile sololearns browser doesnt work
17th Nov 2017, 6:09 AM
MohanPierce
MohanPierce - avatar
0
it's the same problem for me... perhaps a way with the url code of the prog
14th Jan 2018, 1:39 PM
Jean-Philippe Czs
Jean-Philippe Czs - avatar
0
pfffffff and the css anim ?...
14th Jan 2018, 2:19 PM
Jean-Philippe Czs
Jean-Philippe Czs - avatar
0
will try this it clones a div and then the css anim are restarted.... pffff would have been so simple with a location.reload ()...... var elm = this, var newone = elm.cloneNode(true); elm.parentNode.replaceChild(newone, elm);
14th Jan 2018, 2:37 PM
Jean-Philippe Czs
Jean-Philippe Czs - avatar
0
interesting Kirk ok ......
14th Jan 2018, 6:45 PM
Jean-Philippe Czs
Jean-Philippe Czs - avatar