javascript - Prevent a user from exiting from firefox using js -


how can prevent user exit firefox? want user woldn`t leave page before required fields filled. happy see full example... thanks

you can't stop closing browser, or navigating away page, if that's want do. it's their browser - can't force them anything.

that said, can pop message hooking onbeforeunload event , returning string if there still actions want them perform. browsers display string in dialog asking whether want navigate away (or close browser etc), the firefox devs have taken stance that security risk , present generic message instead. in place, user can still choose close browser or navigate away.


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -