S
S
syrotatsypidtchay2014-10-24 15:55:02
JavaScript
syrotatsypidtchay, 2014-10-24 15:55:02

How to stop reloading js - functions when refreshing the page (pressing F5)?

I have added a blockUI element to an ASP NET jquery project. Works like a popup. I call it from codebehinde like this.

var script = "Sys.Application.add_load(function() {errorDialogStart('WebForm2 Loading...','WebForm2.aspx')}); ";
                ClientScript.RegisterStartupScript(this.GetType(),
                    "blockUI", script, true);

The window has an OK button that closes the element and navigates to another page. But when you press the back button or press F5 in the browser (Google Chrome, for example), the script that opens blockUI fires again. How can you stop it from working?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
X
Xandrio, 2014-10-24
@Xandrio

xs even if there is a reboot ... try adding some variable to the url when you run the script, and correct the history (so that when you click back everything was normal there).
Well, before running the script, naturally check the url for the presence of this variable :)
MB will do. Well, I think it's a hack. although if there is such an opportunity - then why not use it ?!
otherwise I don't know how. IMHO a more obvious solution.

D
Dmitry Evgrafovich, 2014-10-24
@Tantacula

Add after the cookie is triggered and set the script to run if it is missing.

N
Nadarik, 2014-10-24
@Nadarik

try some more manipulation with local/session Storage. In this case, at least the url will not need to be "spoiled" :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question