javascript - Simulate turning on Sticky Keys in Windows -


using javascript, trying provide users option turn on sticky keys.

manually can done pressing shift key 5 times.

no success following. tried shiftkeyarg set true.

function stickykeys() { var keyboardevent1 = document.createevent("keyboardevent"); var initmethod = typeof keyboardevent1.initkeyboardevent !== 'undefined' ? "initkeyboardevent" : "initkeyevent"; keyboardevent1[initmethod]( "keydown", // event type : keydown, keyup, keypress true, // bubbles true, // cancelable window, // viewarg: should window false, // ctrlkeyarg false, // altkeyarg false, // shiftkeyarg false, // metakeyarg 16, 0 ); var keyboardevent2 = document.createevent("keyboardevent"); var initmethod = typeof keyboardevent2.initkeyboardevent !== 'undefined' ? "initkeyboardevent" : "initkeyevent"; keyboardevent2[initmethod]( "keyup", // event type : keydown, keyup, keypress true, // bubbles true, // cancelable window, // viewarg: should window false, // ctrlkeyarg false, // altkeyarg false, // shiftkeyarg false, // metakeyarg 16, 0 ); document.dispatchevent(keyboardevent1); document.dispatchevent(keyboardevent2); document.dispatchevent(keyboardevent1); document.dispatchevent(keyboardevent2); document.dispatchevent(keyboardevent1); document.dispatchevent(keyboardevent2); document.dispatchevent(keyboardevent1); document.dispatchevent(keyboardevent2); document.dispatchevent(keyboardevent1); document.dispatchevent(keyboardevent2); alert("sticky keys on"); } 

won't work browser (at least standard 1 security), because doing triggering event in browser's javascript engine, not in win32api handles windows events.

this on purpose, security reasons.

you need plugin, activex or unstandardised browser elevates events os.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -