nw.js icon indicating copy to clipboard operation
nw.js copied to clipboard

Enter 'Backspace' This site can't be reached

Open owen-hong opened this issue 10 years ago • 10 comments

Enter 'Backspace' This site can't be reached image

owen-hong avatar May 25 '16 09:05 owen-hong

Thanks for reporting. Will fix it soon.

rogerwang avatar May 27 '16 05:05 rogerwang

@owen-hong how to reproduce this?

rogerwang avatar May 30 '16 06:05 rogerwang

@rogerwang Open http://localhost:3030 with NW, then click "backspace",u'll see it. My package.json : image

owen-hong avatar Jun 01 '16 08:06 owen-hong

How did you open it? I cannot reproduce...

rogerwang avatar Jun 21 '16 09:06 rogerwang

My index.html use "window.location = 'http://localhost:3030';" open http://localhost:3030 image

owen-hong avatar Jun 21 '16 12:06 owen-hong

I still cannot reproduce it with the following sample, does it reproduce for you?

<!DOCTYPE html>
<html>
  <head>
    <meta charset='UTF-8'>
    <title>NW Test</title>
  </head>
  <body>
    <script>
function test2() {
  window.location = 'http://localhost/';
}
    </script>
<button onclick="test2()">test2</button>
  </body>
</html>

rogerwang avatar Jun 26 '16 08:06 rogerwang

I met the same problem and solved with the following code.

window.addEventListener('keydown', function (e) {
  if (e.keyCode === 8 && e.target === document.body) {
    e.preventDefault();
  }
});

liaozhongwu avatar Sep 01 '16 03:09 liaozhongwu

I solved with the following code.

window.addEventListener('keydown', function (e) {
  var type = e.target.type;
  if(e.keyCode==8 && type !== 'text' && type !== 'password' && type !== 'textarea'){
      e.preventDefault();
   }
});

owen-hong avatar Sep 02 '16 03:09 owen-hong

would tagName !== 'INPUT' && tagName !== 'TEXTAREA' be better?

liaozhongwu avatar Sep 02 '16 03:09 liaozhongwu

I also can't reproduce this issue with window.location = 'http://localhost:8080/' on nwjs-sdk-v0.21.5.

Christywl avatar Apr 10 '17 05:04 Christywl