Javascript window.onsave event -
is there way detect/intercept when user tries save page? allow me embed external files , provide user fully-functional offline app.
the other solution embedding resources beginning, consumes many resources , and takes away of dynamic capability.
any alternative not require any external libraries (including jquery, respect it, loads project) acceptable.
there no window.onsave event find. however, listen ctrl+s keystroke intercepted.
var isctrl = false; document.onkeyup=function(e){ if(e.keycode == 17) isctrl=false; } document.onkeydown=function(e){ if(e.keycode == 17) isctrl=true; if(e.keycode == 83 && isctrl == true) { //run code ctrl+s -- ie, save! return false; } }
code courtesy of: how capture ctrl-s without jquery or other library?
Comments
Post a Comment