Restrict mode checking on-the-fly

Executing example-restrict-mode-on-the-fly.js. Bring up your console.