Nw.js: feature request: disable autocomplete

Created on 2 Aug 2016  路  25Comments  路  Source: nwjs/nw.js

nw 0.16 now autocompletes/autofills username and password fields

in the normal browser world, this is fine, but in nwjs land, where the scope of the application is expanded, there are use-cases where autocomplete data is never desired (for example the app we are developing has important security considerations)

this is marked 'wontfix' by the chromium team (since in the narrow scope of websites why would the browser prevent a user from saving their own username?), so a fix won't come from upstream.

would nwjs team consider adding this as a feature, perhaps as a flag? the workaround proposed in #5151 no longer seems to work (autofill=off flags don't seem to be respected)

Most helpful comment

Still happening on most recent version (0.24.3)

All 25 comments

Will fix it. Thanks.

@conceptualspace, @rogerwang

This actually works (at least for me) if you add the autocomplete="off" attribute to the form element which contains your inputs.

(Using 0.16.1)

See: MDN Documentation

thanks @bajankristof

confirmed working on nw0.16.1 when autocomplete attribute applied to the input elements

(not working for me when applied to the form element, but that could be a problem with my code)

cheers

Flag, which turns off autocomplete/autofill entirely will be still useful :)

autocomplete="off" on an input element doesn't work for me (0.16.1-sdk)

I can confirm it's remembering password only on windows
broken on:

  • 0.16.1 sdk (win)
  • 0.15.x sdk (win)

The same version on os x seems to be not remembering passwords.
Removing {name}/Default/Login Data file helps.

@rogerwang pls fix asap, seems to be very critical security issue

if you had autocomplete data saved to your cache from before you disabled the inputs, it will still be present.

rm ~/Library/Application Support/YOURAPPNAME/Default/Login Data/* and try again

Yes, it will be usefull. I suggest next logic, if possible:
1) Flag to turn off/on;
2) Feature for saving credentials (not a chromium standard popup) for some list of inputs (1,2,3, etc) - for example, I just want to have some simple checkbox in UI and don't want to alert user with useless dialogs.

I had a problem, where autocomplete="off" wouldnt work. What worked for me was using autocomplete="nope" on regular fields and on password fields autocomplete="new-password"

In version of 17.6 'autocomplete=off' WORKS FINE,It reproduces this issue when the same application switch to version 18.

@oaleynik @sean220 @conceptualspace
I use nw 18 on both Linux and Win10, autocomplete="off"/"on" works well. Could you try again and provide more info to reproduce?

The steps of mine:

  1. The contents of my index.html is from http://www.w3school.com.cn/tiy/t.asp?f=html5_input_autocomplete
<!DOCTYPE HTML>
<html>
<body>
<form action="http://www.w3school.com.cn/example/html5/demo_form.asp" method="get" autocomplete="on">
First name:<input type="text" name="fname" /><br />
Last name: <input type="text" name="lname" /><br />
E-mail: <input type="email" name="email" autocomplete="off" /><br />
<input type="submit" />
</form>
</body>
</html>
  1. Run the app and then fill the input box.

  2. Relaunch the app again and fill again, I can see autocomplete is enabled in "First name" and "Last name" boxs, and is disabled in "E-mail" box.

  3. Change the value of above "autocomplete", I can see the correct corresponding changes.

ping again, @oaleynik @sean220 @conceptualspace

@xzhan96 I have not been checking this lately. My workaround for this issue was to not enclose inputs in form element.

^^ same as above -- I'm on nw 0.17.6 with inputs outside form element and all is well

one thing for others to note if they are still stuck: i was seeing autocomplete data populated if it existed in the cache, even if the attribute was disabled on the input. you'll want to clear that before attempting to replicate issue (in other words setting may only apply to saving the value not reading it)

,It reproduces this issue when the same application switch to version 18.

@sean220 could you double check my above comment?

@xzhan96 Not sure if you are still unable to reproduce the problem, but as I was having this issue, till I read Helidium's post, I will give you the HTML I was using that caused my headache.

<div class="content">
    <div class="subsets">
        <label>Username</label>
        <input type="text" id="username" tabindex="1" autocomplete="off" />
    </div>
    <div class="subsets">
            <label>Password</label>
            <input type="password" id="password" tabindex="2"  autocomplete="off" />
    </div>
    <div class="subsets">
        <input type="button" id="exitbtn" value="Cancel" tabindex="4" />
        <input type="button" id="loginbtn" value="Login" tabindex="3" />
    </div>
</div>

I just tested quite a few variations of my code, I removed all reference to username and password, even the "labels" and only when I changed the "type" attribute in the password field did it stop suggesting a username and password. So it looks like chromium is looking for the "type=password" attribute and then just assumes that the previous text field is the username. Also, it does not seem to matter whether it is inside of a "form" element.

Just for reference I am using version 0.19.0 on windows 7 professional.

@Kriknos Thanks for your detailed information, I will try it later, and could you also double check if you can reproduce with my sample?

@Kriknos I tried your sample, but I can't reproduce the problem, could you tell me the detailed steps and a whole sample?
Or if Helidium's post works well, I think this issue can be closed.

If anyone else comes here from Google, try setting autocomplete="new-password" on your password field.

@skylarmt
autocomplete="new-password" works well. But I have two password fields in my form. It looks like I am not able to use autocomplete = "new-password" for the second password field.

I would like to disable autocomplete completely (we have a touch application that is publicly available) but it seems that non of the available chromium flags are working:

  • --disable-single-click-autofill
  • --disable-password-generation

In chrome we have these settings:
password

autocomplete="new-password" worked for me as well. Thanks @skylarmt

Still happening on most recent version (0.24.3)

@skylarmt doesn't work on latest version 0.25.0

Use the following code when exiting the main window maybe help.
javascript chrome.passwordsPrivate.getSavedPasswordList(function(passwords) { chrome.passwordsPrivate.removeSavedPassword(passwords[0].loginPair); });

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xland picture xland  路  3Comments

niutech picture niutech  路  4Comments

imyzf picture imyzf  路  4Comments

Asp3ctus picture Asp3ctus  路  4Comments

azer picture azer  路  3Comments