Skip to content Skip to sidebar Skip to footer

Determine The 'Overtype' Mode Using Javascript

We are creating a web app to replace an old-school green-screen application. In the green-screen app, as the user presses the Insert key to switch between overtype and insert modes

Solution 1:

In IE you can use document.queryCommandValue("OverWrite").

For IE only:

function isOverwriteEnabled() {
    try {
        // try the MSIE way
        return document.queryCommandValue("OverWrite");
    } catch (ex) {
        // not MSIE => not supported
        return false;
    }
}

Firefox, Chrome, and Safari:

Because Mac does not have nor support the "insert" key, Safari will never ever support "insert" mode.

For Chrome and Firefox, "insert" mode is not encouraged for support as Mac does not have it. (Also, see "Furthermore")

That also means, since Windows supports "insert" mode, that IE will more than likely always support it.

Furthermore:

Firefox has a bug report classified as "WontFix" for years, so the "Insert" key will probably never be supported.


Solution 2:

The problem is that if the user presses the insert key after entering your page then you can track down it easily.

But when the user has already pressed the insert key before entering your page then it seems to be a difficult task.


Solution 3:

I suggest careful consideration of the 'overtype' feature. Does this behavior make sense in the web context, at all?

What utility does the 'overtype' feature provides in the old ANSI presentation which is unavailable through the web?

Unless I'm fully misunderstanding your question (apologies if so), I feel like the development intent may not align well with user expectations and typical web conventions.

If the goal is to produce a page where:

  • by default 'insert' mode is disabled
  • user can trigger 'insert mode' for editing purposes

...then why not use dynamic form inputs?

When a user clicks on a particular segment of HTML, a JavaScript is used to present the content as an element whose default value matches the chosen HTML tag.

Once editing is completed the input is parsed, the page updated, and form input removed from display.

Would this method suit your needs?


Post a Comment for "Determine The 'Overtype' Mode Using Javascript"