/    Sign up×
Community /Pin to ProfileBookmark

Disabling "Are you sure you want to navigate away from this page" warning?

I was wondering if somebody could tell me how to disable the warning mentioned in the title. I have pop-ups that require passwords, and when entered and submitted redirect to another page. I’d prefer this to be seamless, but I need to get rid of the warning message first.

Anybody know how?

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@toicontienDec 09.2010 — In the window object's unload event, a confirm() function call is probably causing this. You could try setting window.onunload = null; some place in JavaScript to see if that short circuits the dialog.

Really though, we need to see the code generating this confirm window. Tracking that code down will be your first step.
Copy linkTweet thisAlerts:
@ReeceauthorDec 09.2010 — I just copied/pasted from a website, didn't feel like taking the time to write my own code. I'm terrible with javascript, or programming in general. Anyway, this is basically what it is.

[code=html]<html>
<HEAD>

<noscript></noscript><!-- --><script type="text/javascript" src="http://www.freewebs.com/p.js"></script><script type="text/javascript">
<!-- Begin
/* This script and many more are available free online at
The JavaScript Source :: http://javascript.internet.com
Created by: Javascript Newbie :: http://expage.com/javascriptnewbie
*/

var password;
var pass1 = "s7edr"; // place password here

password=prompt("Please enter password #3:","");

if (password==pass1) {
window.location= "http://42637.webs.com"; // file to open if password is correct
} else {
window.location= "blank.html"; // file to load if password is incorrect
}
// End -->
</script>
<!-- --><script type="text/javascript" src="http://images.webs.com/static/global/js/webs/usersites/escort.js"></script><script type="text/javascript">if(typeof(urchinTracker)=='function'){_uacct="UA-230305-2";_udn="none";_uff=false;urchinTracker();}</script></head>[/code]
Copy linkTweet thisAlerts:
@toicontienDec 09.2010 — The <script> tag that loads p.js from freewebs.com is responsible. If you remove that <script> tag the warning should go away.
Copy linkTweet thisAlerts:
@toicontienDec 09.2010 — As a side note, if you run across minified JavaScript, you can use http://jsbeautifier.org/ to reformat it and make it more readable.
×

Success!

Help @Reece spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...