X
Tap here to go to the mobile version of the site.
Scheduled maintenance: Thursday, April 2, between 3pm and 5pm UTC. This site will have limited functionality while we undergo maintenance to improve your experience. If an article doesn’t solve your issue and you want to ask a question, we have our support community waiting to help you at @firefox on Twitter

Support Forum

How to print out my passwords in Firefox? I need to migrate user names and passwords for various web sites to a new computer

Posted

https://support.mozilla.org/en-US/questions/1253828 does not seem to work because the caret (») is not visible in Firefox 72.0.2 (64-bit) that is on my machine. This is most annoying. Firefox and T'Bird are the most difficult software to migrate to new computers.

I need the export as a CVS. The other approaches either don't allow copy and paste or they are JSON and I have no clue how rto use that.

The other angle: logins.json (passwords) and key4.db (58+) for Passwords saved in the Password Manager I don't see a way to get that into a spreadsheet.

It is particularly annoying because there is an import function but no export function. I have over 300 web site user names and passwords. Hours and hours of work to just copy one at a time.

https://support.mozilla.org/en-US/questions/1253828 does not seem to work because the caret (») is not visible in Firefox 72.0.2 (64-bit) that is on my machine. This is most annoying. Firefox and T'Bird are the most difficult software to migrate to new computers. I need the export as a CVS. The other approaches either don't allow copy and paste or they are JSON and I have no clue how rto use that. The other angle: logins.json (passwords) and key4.db (58+) for Passwords saved in the Password Manager I don't see a way to get that into a spreadsheet. It is particularly annoying because there is an import function but no export function. I have over 300 web site user names and passwords. Hours and hours of work to just copy one at a time.

Modified by SFSecurity

Chosen solution

You can open one of the developer tools (e.g. right-click on a web page: Inspect Element). Once the developer toolbox is open and has focus you can press the F1 key to go to the settings page.

On the settings page, look under Advanced settings and tick this item:

  • select "Enable browser chrome and add-on debugging toolboxes" in the developer tools settings

See:

  • https://media.prod.mdn.mozit.cloud/attachments/2018/07/09/16081/6b9847c8c30082f422b80889cd4fc755/dev_tools_settings.png

Once you have made this change, you should see a command line in the Browser Console.

You can paste the first part of the code in the command line. You probably need to type some text as a security measure to confirm that you want to paste text in the console.


/* export logins as JSON */
signons = prompt("Logins",JSON.stringify(Services.logins.getAllLogins()));

This should give you a prompt window that allows to copy the login data to the clipboard via Ctrl+C.

You can paste this login data in a text file and transfer this file to the other computer via a portable USB drive.

On the other computer you can repeat the first steps and enable the command line in the Browser Console in the same way (open a developer tool and press F1 to go to settings and tick the box).

You can then open the Browser Console and paste the second part of the code to import the logins. In the prompt you can paste the content of the file where you previously saved the JSON login data.


/* import Logins from JSON */
if (logins = prompt("Array of JSON Logins",signons)){
try {
 logins = JSON.parse(logins);
 var i,lg;
 for (i=0; lg=logins[i]; i++){if (!lg.origin){lg.origin = lg.hostname}}
 ChromeUtils.import("resource://gre/modules/LoginHelper.jsm");
 LoginHelper.maybeImportLogins(logins);
} catch(e){ console.log(e); }
}

Importing is done asynchronously and it can take a few second before the logins are available in the Password Manager.

Read this answer in context 0
Quote

Additional System Details

Installed Plug-ins

  • Shockwave Flash 32.0 r0

Application

  • User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0

More Information

Question owner

I started this because I didn't see how to edit my original post at first.

I started this because I didn't see how to edit my original post at first.

Modified by SFSecurity

Was this helpful to you?
Quote
cor-el
  • Top 10 Contributor
  • Moderator
17857 solutions 161589 answers

You can copy logins.json and key4.db from one profile to another profile to migrate the logins.


You can copy files like these with Firefox closed to the current profile folder to recover specific data.

  • bookmarks and history: places.sqlite
  • bookmark backups: compressed .jsonlz4 JSON backups in the bookmarkbackups folder
  • cookies.sqlite for the Cookies
  • formhistory.sqlite for saved autocomplete Form Data
  • logins.json (passwords) and key4.db (58+) or key3.db (57 and older) (decryption key) for Passwords saved in the Password Manager
    if you only have key3.db then make sure to remove an existing key4.db
  • cert9.db (58+) or cert8.db (57 and older) for (intermediate) certificates stored in the Certificate Manager
    if you only have cert8.db then make sure to remove an existing cert9.db
  • persdict.dat for words you added to the spelling checker dictionary
  • permissions.sqlite for Permissions and possibly content-prefs.sqlite for other website specific data (Site Preferences)
  • sessionstore.jsonlz4 for open tabs and pinned tabs (see also the sessionstore-backups folder)

See also:

You can copy logins.json and key4.db from one profile to another profile to migrate the logins. ----- You can copy files like these with Firefox closed to the current profile folder to recover specific data. *bookmarks and history: places.sqlite *bookmark backups: compressed .jsonlz4 JSON backups in the bookmarkbackups folder *cookies.sqlite for the Cookies *formhistory.sqlite for saved autocomplete Form Data *logins.json (passwords) and key4.db (58+) or key3.db (57 and older) (decryption key) for Passwords saved in the Password Manager<br>if you only have key3.db then make sure to remove an existing key4.db *cert9.db (58+) or cert8.db (57 and older) for (intermediate) certificates stored in the Certificate Manager<br>if you only have cert8.db then make sure to remove an existing cert9.db *persdict.dat for words you added to the spelling checker dictionary *permissions.sqlite for Permissions and possibly content-prefs.sqlite for other website specific data (Site Preferences) *sessionstore.jsonlz4 for open tabs and pinned tabs (see also the sessionstore-backups folder) See also: *https://support.mozilla.org/en-US/kb/recovering-important-data-from-an-old-profile
Was this helpful to you?
Quote
RobertJ
  • Top 10 Contributor
152 solutions 1549 answers

Try this:

Type (or paste)

chrome://passwordmgr/content/passwordManager.xul

in the address bar and press Enter.

Your window will resize and, If you are not already signed in, enter your Master Password to Show logins and again to Show passwords.

You should then be able to print or screenshot your logins & passwords.

Try this: Type (or paste) chrome://passwordmgr/content/passwordManager.xul in the address bar and press Enter. Your window will resize and, If you are not already signed in, enter your Master Password to Show logins and again to Show passwords. You should then be able to print or screenshot your logins & passwords.
Was this helpful to you? 0
Quote
cor-el
  • Top 10 Contributor
  • Moderator
17857 solutions 161589 answers

You can use code in the Browser Console to export and import logins data.

To enable the command line in the Console:


/* export logins as JSON */
logins = prompt("Logins",JSON.stringify(Services.logins.getAllLogins()));

/* import Logins from JSON */
if (logins = prompt("Array of JSON Logins",logins||"")){
try {
 logins = JSON.parse(logins);
 var i,lg;
 for (i=0; lg=logins[i]; i++){if (!lg.origin){lg.origin = lg.hostname}}
 ChromeUtils.import("resource://gre/modules/LoginHelper.jsm");
 LoginHelper.maybeImportLogins(logins);
} catch(e){ console.log(e); }
}
You can use code in the Browser Console to export and import logins data. To enable the command line in the Console: *select "Enable browser chrome and add-on debugging toolboxes" in the developer tools settings *https://developer.mozilla.org/en-US/Tools/Settings *https://developer.mozilla.org/en-US/Tools/Browser_Console ----- <pre><nowiki>/* export logins as JSON */ logins = prompt("Logins",JSON.stringify(Services.logins.getAllLogins())); /* import Logins from JSON */ if (logins = prompt("Array of JSON Logins",logins||"")){ try { logins = JSON.parse(logins); var i,lg; for (i=0; lg=logins[i]; i++){if (!lg.origin){lg.origin = lg.hostname}} ChromeUtils.import("resource://gre/modules/LoginHelper.jsm"); LoginHelper.maybeImportLogins(logins); } catch(e){ console.log(e); } }</nowiki></pre>

Modified by cor-el

Was this helpful to you?
Quote

Question owner

RobertJ said

Try this: Type (or paste) chrome://passwordmgr/content/passwordManager.xul It displays the info but does not allow copy and paste or other export function. I somewhat knowledgeable but not enough to make this work without a more step by step set of instructions.
''RobertJ [[#answer-1283678|said]]'' <blockquote> Try this: Type (or paste) chrome://passwordmgr/content/passwordManager.xul It displays the info but does not allow copy and paste or other export function. I somewhat knowledgeable but not enough to make this work without a more step by step set of instructions.
Was this helpful to you?
Quote

Question owner

cor-el said

You can use code in the Browser Console to export and import logins data. To enable the command line in the Console:


I somewhat knowledgeable but not enough to make this work without a more step by step set of instructions.

''cor-el [[#answer-1283682|said]]'' <blockquote> You can use code in the Browser Console to export and import logins data. To enable the command line in the Console: *select "Enable browser chrome and add-on debugging toolboxes" in the developer tools settings *https://developer.mozilla.org/en-US/Tools/Settings *https://developer.mozilla.org/en-US/Tools/Browser_Console ----- I somewhat knowledgeable but not enough to make this work without a more step by step set of instructions.
Was this helpful to you?
Quote
cor-el
  • Top 10 Contributor
  • Moderator
17857 solutions 161589 answers

Chosen Solution

You can open one of the developer tools (e.g. right-click on a web page: Inspect Element). Once the developer toolbox is open and has focus you can press the F1 key to go to the settings page.

On the settings page, look under Advanced settings and tick this item:

  • select "Enable browser chrome and add-on debugging toolboxes" in the developer tools settings

See:

  • https://media.prod.mdn.mozit.cloud/attachments/2018/07/09/16081/6b9847c8c30082f422b80889cd4fc755/dev_tools_settings.png

Once you have made this change, you should see a command line in the Browser Console.

You can paste the first part of the code in the command line. You probably need to type some text as a security measure to confirm that you want to paste text in the console.


/* export logins as JSON */
signons = prompt("Logins",JSON.stringify(Services.logins.getAllLogins()));

This should give you a prompt window that allows to copy the login data to the clipboard via Ctrl+C.

You can paste this login data in a text file and transfer this file to the other computer via a portable USB drive.

On the other computer you can repeat the first steps and enable the command line in the Browser Console in the same way (open a developer tool and press F1 to go to settings and tick the box).

You can then open the Browser Console and paste the second part of the code to import the logins. In the prompt you can paste the content of the file where you previously saved the JSON login data.


/* import Logins from JSON */
if (logins = prompt("Array of JSON Logins",signons)){
try {
 logins = JSON.parse(logins);
 var i,lg;
 for (i=0; lg=logins[i]; i++){if (!lg.origin){lg.origin = lg.hostname}}
 ChromeUtils.import("resource://gre/modules/LoginHelper.jsm");
 LoginHelper.maybeImportLogins(logins);
} catch(e){ console.log(e); }
}

Importing is done asynchronously and it can take a few second before the logins are available in the Password Manager.

You can open one of the developer tools (e.g. right-click on a web page: Inspect Element). Once the developer toolbox is open and has focus you can press the F1 key to go to the settings page. On the settings page, look under Advanced settings and tick this item: *select "Enable browser chrome and add-on debugging toolboxes" in the developer tools settings See: *https://media.prod.mdn.mozit.cloud/attachments/2018/07/09/16081/6b9847c8c30082f422b80889cd4fc755/dev_tools_settings.png Once you have made this change, you should see a command line in the Browser Console. *"3-bar" menu button or Tools -> Web Developer *https://developer.mozilla.org/en-US/Tools/Browser_Console You can paste the first part of the code in the command line. You probably need to type some text as a security measure to confirm that you want to paste text in the console. ---- <pre><nowiki> /* export logins as JSON */ signons = prompt("Logins",JSON.stringify(Services.logins.getAllLogins())); </nowiki></pre> ---- This should give you a prompt window that allows to copy the login data to the clipboard via Ctrl+C. You can paste this login data in a text file and transfer this file to the other computer via a portable USB drive. On the other computer you can repeat the first steps and enable the command line in the Browser Console in the same way (open a developer tool and press F1 to go to settings and tick the box). You can then open the Browser Console and paste the second part of the code to import the logins. In the prompt you can paste the content of the file where you previously saved the JSON login data. ---- <pre><nowiki> /* import Logins from JSON */ if (logins = prompt("Array of JSON Logins",signons)){ try { logins = JSON.parse(logins); var i,lg; for (i=0; lg=logins[i]; i++){if (!lg.origin){lg.origin = lg.hostname}} ChromeUtils.import("resource://gre/modules/LoginHelper.jsm"); LoginHelper.maybeImportLogins(logins); } catch(e){ console.log(e); } }</nowiki></pre> ---- Importing is done asynchronously and it can take a few second before the logins are available in the Password Manager.

Modified by cor-el

Was this helpful to you?
Quote

Question owner

cor-el said

You can open one of the developer tools (e.g. right-click on a web page: Inspect Element). Once the developer toolbox is open and has focus you can press the F1 key to go to the settings page. On the settings page, look under Advanced settings and tick this item:
  • select "Enable browser chrome and add-on debugging toolboxes" in the developer tools settings
See:
  • https://media.prod.mdn.mozit.cloud/attachments/2018/07/09/16081/6b9847c8c30082f422b80889cd4fc755/dev_tools_settings.png
================

I'm too tired to do this tonight but I think this will work. I greatly appreciate the step by step description of what to do. It helps prevent mistakes.

Allen

''cor-el [[#answer-1283700|said]]'' <blockquote> You can open one of the developer tools (e.g. right-click on a web page: Inspect Element). Once the developer toolbox is open and has focus you can press the F1 key to go to the settings page. On the settings page, look under Advanced settings and tick this item: *select "Enable browser chrome and add-on debugging toolboxes" in the developer tools settings See: *https://media.prod.mdn.mozit.cloud/attachments/2018/07/09/16081/6b9847c8c30082f422b80889cd4fc755/dev_tools_settings.png ============================ I'm too tired to do this tonight but I think this will work. I greatly appreciate the step by step description of what to do. It helps prevent mistakes. Allen
Was this helpful to you?
Quote
McCoy
  • Top 10 Contributor
628 solutions 6017 answers

SFSecurity said

I somewhat knowledgeable but not enough to make this work without a more step by step set of instructions.

Hello SFSecurity,

Type in the address bar :

chrome://passwordmgr/content/passwordManager.xul

Press Enter and maximize the window.

When you highlight an entry you will see a "Show Password" button at the bottom.

(until you highlight an entry that button will be greyed out)

You can highlight all entries; press Ctrl + C to copy the whole page, and then paste it (Ctrl + V).

Note that a few Firefox updates from now (probably Firefox version 73) this will change to :

"chrome://passwordmgr/content/passwordManager.xhtml

''SFSecurity [[#answer-1283696|said]]'' <blockquote> I somewhat knowledgeable but not enough to make this work without a more step by step set of instructions. </blockquote> Hello SFSecurity, Type in the address bar : '''chrome://passwordmgr/content/passwordManager.xul''' Press Enter and maximize the window. When you highlight an entry you will see a "Show Password" button at the bottom. (until you highlight an entry that button will be greyed out) You can highlight all entries; press Ctrl + C to copy the whole page, and then paste it (Ctrl + V). Note that a few Firefox updates from now (probably Firefox version 73) this will change to : "chrome://passwordmgr/content/passwordManager.'''xhtml'''
Was this helpful to you? 0
Quote

Question owner

McCoy said

SFSecurity said
I somewhat knowledgeable but not enough to make this work without a more step by step set of instructions.

Hello SFSecurity,

Type in the address bar :

chrome://passwordmgr/content/passwordManager.xul

Press Enter and maximize the window.

When you highlight an entry you will see a "Show Password" button at the bottom.

(until you highlight an entry that button will be greyed out)

You can highlight all entries; press Ctrl + C to copy the whole page, and then paste it (Ctrl + V).

Note that a few Firefox updates from now (probably Firefox version 73) this will change to :

"chrome://passwordmgr/content/passwordManager.xhtml

=========

My version of Firefox, 72.0.2 (64-bit) does not allow Copy and Paste.

Also the xhtml version gets this response:

File not found

Firefox can’t find the file at jar:file:///C:/Program Files (x86)/Mozilla Firefox/omni.ja!/chrome/toolkit/content/passwordmgr/passwordManager.xhtml.

   Check the file name for capitalization or other typing errors.
   Check to see if the file was moved, renamed or deleted.
''McCoy [[#answer-1283734|said]]'' <blockquote> ''SFSecurity [[#answer-1283696|said]]'' <blockquote> I somewhat knowledgeable but not enough to make this work without a more step by step set of instructions. </blockquote> Hello SFSecurity, Type in the address bar : '''chrome://passwordmgr/content/passwordManager.xul''' Press Enter and maximize the window. When you highlight an entry you will see a "Show Password" button at the bottom. (until you highlight an entry that button will be greyed out) You can highlight all entries; press Ctrl + C to copy the whole page, and then paste it (Ctrl + V). Note that a few Firefox updates from now (probably Firefox version 73) this will change to : "chrome://passwordmgr/content/passwordManager.'''xhtml''' </blockquote> ===================== My version of Firefox, 72.0.2 (64-bit) does not allow Copy and Paste. Also the xhtml version gets this response: File not found Firefox can’t find the file at jar:file:///C:/Program Files (x86)/Mozilla Firefox/omni.ja!/chrome/toolkit/content/passwordmgr/passwordManager.xhtml. Check the file name for capitalization or other typing errors. Check to see if the file was moved, renamed or deleted.
Was this helpful to you?
Quote
McCoy
  • Top 10 Contributor
628 solutions 6017 answers

SFSecurity said

Also the xhtml version gets this response:

McCoy said

Note that a few Firefox updates from now (probably Firefox version 73) this will change to : "chrome://passwordmgr/content/passwordManager.xhtml

For now it is still :

chrome://passwordmgr/content/passwordManager.xul

SFSecurity said

My version of Firefox, 72.0.2 (64-bit) does not allow Copy and Paste.

Could you elaborate on that please ? You can't copy and paste no matter where ?

''SFSecurity [[#answer-1283918|said]]'' <blockquote> Also the xhtml version gets this response: </blockquote> ''McCoy [[#answer-1283734|said]]'' <blockquote> Note that a few Firefox updates from now (probably Firefox version 73) this will change to : "chrome://passwordmgr/content/passwordManager.'''xhtml''' </blockquote> For now it is still : '''chrome://passwordmgr/content/passwordManager.xul''' ''SFSecurity [[#answer-1283918|said]]'' <blockquote> My version of Firefox, 72.0.2 (64-bit) does not allow Copy and Paste. </blockquote> Could you elaborate on that please ? You can't copy and paste no matter where ?
Was this helpful to you?
Quote
cor-el
  • Top 10 Contributor
  • Moderator
17857 solutions 161589 answers

You can only make a screenshot of the passwords in the legacy Password Manager if you use the chrome URI. There is no way to have a backup that you can restore this way.

It there aren't any passwords on the new computer or only a few then simply copy logins.json and key4.db to the profile folder on the new computer like I posted in my first reply.

If you need to preserve passwords you already have made then the procedure with code in the Browser Console will merge passwords.

You can only make a screenshot of the passwords in the legacy Password Manager if you use the chrome URI. There is no way to have a backup that you can restore this way. It there aren't any passwords on the new computer or only a few then simply copy logins.json and key4.db to the profile folder on the new computer like I posted in my first reply. If you need to preserve passwords you already have made then the procedure with code in the Browser Console will merge passwords.
Was this helpful to you?
Quote

Question owner

cor-el said

You can open one of the developer tools (e.g. right-click on a web page: Inspect Element). Once the developer toolbox is open and has focus you can press the F1 key to go to the settings page. On the settings page, look under Advanced settings and tick this item:
  • select "Enable browser chrome and add-on debugging toolboxes" in the developer tools settings
See:
  • https://media.prod.mdn.mozit.cloud/attachments/2018/07/09/16081/6b9847c8c30082f422b80889cd4fc755/dev_tools_settings.png
Once you have made this change, you should see a command line in the Browser Console. You can paste the first part of the code in the command line. You probably need to type some text as a security measure to confirm that you want to paste text in the console.
/* export logins as JSON */
signons = prompt("Logins",JSON.stringify(Services.logins.getAllLogins()));

This should give you a prompt window that allows to copy the login data to the clipboard via Ctrl+C.

======

I got this the third time I did this. I didn't realize that I needed to do a Ctrl+A and a Ctrl+C in the prompt window and the paste it into a text file/document.

======

You can paste this login data in a text file and transfer this file to the other computer via a portable USB drive.

On the other computer you can repeat the first steps and enable the command line in the Browser Console in the same way (open a developer tool and press F1 to go to settings and tick the box).

You can then open the Browser Console and paste the second part of the code to import the logins. In the prompt you can paste the content of the file where you previously saved the JSON login data.


/* import Logins from JSON */
if (logins = prompt("Array of JSON Logins",signons)){
try {
 logins = JSON.parse(logins);
 ChromeUtils.import("resource://gre/modules/LoginHelper.jsm");
 LoginHelper.maybeImportLogins(logins);
} catch(e){ console.log(e); }
}

==========

I keep getting errors when I posted this on the new computer. The "}" on the line with nothing in front of it gets an error, I think because there is a space after it in the post.

I deleted the extra space and when I put:

/* import Logins from JSON */ if (logins = prompt("Array of JSON Logins",signons)){ try {

logins = JSON.parse(logins);
ChromeUtils.import("resource://gre/modules/LoginHelper.jsm");
LoginHelper.maybeImportLogins(logins);

} catch(e){ console.log(e); } }

I got the following error

"ReferenceError: signons is not defined"

"What went wrong?

There is a non-existent variable referenced somewhere. This variable needs to be declared, or you need to make sure it is available in your current script or scope."


I don't see where I need to put the reference or file name or put all of the JSON text file.

''cor-el [[#answer-1283700|said]]'' <blockquote> You can open one of the developer tools (e.g. right-click on a web page: Inspect Element). Once the developer toolbox is open and has focus you can press the F1 key to go to the settings page. On the settings page, look under Advanced settings and tick this item: *select "Enable browser chrome and add-on debugging toolboxes" in the developer tools settings See: *https://media.prod.mdn.mozit.cloud/attachments/2018/07/09/16081/6b9847c8c30082f422b80889cd4fc755/dev_tools_settings.png Once you have made this change, you should see a command line in the Browser Console. *"3-bar" menu button or Tools -> Web Developer *https://developer.mozilla.org/en-US/Tools/Browser_Console You can paste the first part of the code in the command line. You probably need to type some text as a security measure to confirm that you want to paste text in the console. ---- <pre><nowiki> /* export logins as JSON */ signons = prompt("Logins",JSON.stringify(Services.logins.getAllLogins())); </nowiki></pre> ---- This should give you a prompt window that allows to copy the login data to the clipboard via Ctrl+C. ================== I got this the third time I did this. I didn't realize that I needed to do a Ctrl+A and a Ctrl+C in the prompt window and the paste it into a text file/document. ================== You can paste this login data in a text file and transfer this file to the other computer via a portable USB drive. On the other computer you can repeat the first steps and enable the command line in the Browser Console in the same way (open a developer tool and press F1 to go to settings and tick the box). You can then open the Browser Console and paste the second part of the code to import the logins. In the prompt you can paste the content of the file where you previously saved the JSON login data. ---- <pre><nowiki> /* import Logins from JSON */ if (logins = prompt("Array of JSON Logins",signons)){ try { logins = JSON.parse(logins); ChromeUtils.import("resource://gre/modules/LoginHelper.jsm"); LoginHelper.maybeImportLogins(logins); } catch(e){ console.log(e); } }</nowiki></pre> ---- ====================== I keep getting errors when I posted this on the new computer. The "}" on the line with nothing in front of it gets an error, I think because there is a space after it in the post. I deleted the extra space and when I put: /* import Logins from JSON */ if (logins = prompt("Array of JSON Logins",signons)){ try { logins = JSON.parse(logins); ChromeUtils.import("resource://gre/modules/LoginHelper.jsm"); LoginHelper.maybeImportLogins(logins); } catch(e){ console.log(e); } } I got the following error "ReferenceError: signons is not defined" "What went wrong? There is a non-existent variable referenced somewhere. This variable needs to be declared, or you need to make sure it is available in your current script or scope." I don't see where I need to put the reference or file name or put all of the JSON text file.

Modified by SFSecurity

Was this helpful to you?
Quote
cor-el
  • Top 10 Contributor
  • Moderator
17857 solutions 161589 answers

Oops, yes signons isn't defined with only the import code. You can use this code or use the full code (export and import).

/* import Logins from JSON */
if (logins = prompt("Array of JSON Logins",logins||"")){
try {
 logins = JSON.parse(logins);
 var i,lg;
 for (i=0; lg=logins[i]; i++){if (!lg.origin){lg.origin = lg.hostname}}
 ChromeUtils.import("resource://gre/modules/LoginHelper.jsm");
 LoginHelper.maybeImportLogins(logins);
} catch(e){ console.log(e); }
}

It would work with the full code because that defines the var. That would also allow to backup existing logins.

/* export current logins as JSON */
logins = prompt("Logins",JSON.stringify(Services.logins.getAllLogins()));

/* import Logins from JSON */
if (logins = prompt("Array of JSON Logins",logins||"")){
try {
 logins = JSON.parse(logins);
 var i,lg;
 for (i=0; lg=logins[i]; i++){if (!lg.origin){lg.origin = lg.hostname}}
 ChromeUtils.import("resource://gre/modules/LoginHelper.jsm");
 LoginHelper.maybeImportLogins(logins);
} catch(e){ console.log(e); }
}
Oops, yes signons isn't defined with only the import code. You can use this code or use the full code (export and import). <pre><nowiki>/* import Logins from JSON */ if (logins = prompt("Array of JSON Logins",logins||"")){ try { logins = JSON.parse(logins); var i,lg; for (i=0; lg=logins[i]; i++){if (!lg.origin){lg.origin = lg.hostname}} ChromeUtils.import("resource://gre/modules/LoginHelper.jsm"); LoginHelper.maybeImportLogins(logins); } catch(e){ console.log(e); } }</nowiki></pre> ----- It would work with the full code because that defines the var. That would also allow to backup existing logins. <pre><nowiki>/* export current logins as JSON */ logins = prompt("Logins",JSON.stringify(Services.logins.getAllLogins())); /* import Logins from JSON */ if (logins = prompt("Array of JSON Logins",logins||"")){ try { logins = JSON.parse(logins); var i,lg; for (i=0; lg=logins[i]; i++){if (!lg.origin){lg.origin = lg.hostname}} ChromeUtils.import("resource://gre/modules/LoginHelper.jsm"); LoginHelper.maybeImportLogins(logins); } catch(e){ console.log(e); } }</nowiki></pre>

Modified by cor-el

Was this helpful to you?
Quote

Question owner

I have tried both versions that you suggest and get the prompt each time and added the carry-over from the old computer and hit "Okay" but nothing happens even after rebooting Firefox and the computer.

The only username/password that shows up is my current Firefox:

accounts.firefox.com

What am I doing wrong?

I have tried both versions that you suggest and get the prompt each time and added the carry-over from the old computer and hit "Okay" but nothing happens even after rebooting Firefox and the computer. The only username/password that shows up is my current Firefox: accounts.firefox.com What am I doing wrong?

Modified by SFSecurity

Was this helpful to you?
Quote
cor-el
  • Top 10 Contributor
  • Moderator
17857 solutions 161589 answers

Do you see any messages in the Browser Console related to importing logins ?

You do run the JavaScript code in the Browser Console (it won't run in the Web Console) ?

Do you see any messages in the Browser Console related to importing logins ? You do run the JavaScript code in the Browser Console (it won't run in the Web Console) ?

Modified by cor-el

Was this helpful to you?
Quote

Question owner

Yes, I used the JavaScript code in the Browser Console and that is what got me the image in my prior reply. Still not adding usernames and passwords to Firefox on the new computer.

Yes, I used the JavaScript code in the Browser Console and that is what got me the image in my prior reply. Still not adding usernames and passwords to Firefox on the new computer.

Modified by SFSecurity

Was this helpful to you?
Quote
cor-el
  • Top 10 Contributor
  • Moderator
17857 solutions 161589 answers

Does Firefox parse the file correctly if you give the file a .json file extension and open the file in a Firefox tab to make the builtin JSON viewer dis[lay the content ?

Does Firefox parse the file correctly if you give the file a .json file extension and open the file in a Firefox tab to make the builtin JSON viewer dis[lay the content ? *https://developer.mozilla.org/en-US/Tools/JSON_viewer
Was this helpful to you?
Quote
Ask a question

You must log in to your account to reply to posts. Please start a new question, if you do not have an account yet.