Windows 10 reached EOS (end of support) on October 14, 2025. For more information, see this article.

Caută ajutor

Atenție la excrocheriile de asistență. Noi nu îți vom cere niciodată să suni sau să trimiți vreun SMS la vreun număr de telefon sau să dai informații personale. Te rugăm să raportezi activitățile suspecte folosind opțiunea „Raportează un abuz”.

Află mai multe

Can't print the saved passwords using code posted by cor-el on 8/13/15 & modified 2/22/2018.

  • 9 răspunsuri
  • 1 are această problemă
  • 27 de vizualizări
  • Ultimul răspuns dat de cor-el

mai multe opțiuni

Tried using code from cor-el. First one worked using browser console, but second in web console gives following error: SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

Using Mac OS 10.12.6 and Firefox 58.0.2

Need to get usable hard copy and database/spreadsheet data.

thanks

Tried using code from cor-el. First one worked using browser console, but second in web console gives following error: SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data Using Mac OS 10.12.6 and Firefox 58.0.2 Need to get usable hard copy and database/spreadsheet data. thanks

Soluție aleasă

Aha, yes, recent versions of Firefox have a fancier viewer for JSON-format files. As a result, the body now contains extra tags that you need to bypass to read out the data.

First, you still generate the same firefox-logins.json file using the Browser Console script.

Second, open the firefox-logins.json file in a Firefox tab, and pause until the viewer renders.

Third, click the "Raw Data" heading, and then run the updated script (first line modified) in the Web Console:

json = document.querySelector('pre.data').textContent;
var signons = JSON.parse(json);
var names = "";
for (var i=0; SG=signons[i]; i++) {
try {
 var host = SG.hostname||"";
 var user = SG.username||"";
 var pass = SG.password||"";
 names += "<tr><td>"+ (i+1) + "<td>" + host + "<td>" + user + "<td>" + pass;
} catch(e){}
}
var body = '<table border="1" cellspacing="0">\n'+
'<tr class="head">\n'+
'<td>#\n'+
'<td><b>Host</b>\n'+
'<td><b>User name</b>\n'+
'<td><b>Password</b>\n'+
names+
'</table>\n';
document.body.innerHTML = body;

This could be integrated with the Browser Console script if someone has time to do it so that you do not need multiple steps.

(Now I have to permanently delete firefox-logins.json from my system!)

Citește răspunsul în context 👍 1

Toate răspunsurile (9)

mai multe opțiuni

Can you link to the thread that you're referring to?

mai multe opțiuni

Using code in this thread: https://support.mozilla.org/en-US/questions/1077630

Code is near the end of thread. Thanks

mai multe opțiuni

Soluție aleasă

Aha, yes, recent versions of Firefox have a fancier viewer for JSON-format files. As a result, the body now contains extra tags that you need to bypass to read out the data.

First, you still generate the same firefox-logins.json file using the Browser Console script.

Second, open the firefox-logins.json file in a Firefox tab, and pause until the viewer renders.

Third, click the "Raw Data" heading, and then run the updated script (first line modified) in the Web Console:

json = document.querySelector('pre.data').textContent;
var signons = JSON.parse(json);
var names = "";
for (var i=0; SG=signons[i]; i++) {
try {
 var host = SG.hostname||"";
 var user = SG.username||"";
 var pass = SG.password||"";
 names += "<tr><td>"+ (i+1) + "<td>" + host + "<td>" + user + "<td>" + pass;
} catch(e){}
}
var body = '<table border="1" cellspacing="0">\n'+
'<tr class="head">\n'+
'<td>#\n'+
'<td><b>Host</b>\n'+
'<td><b>User name</b>\n'+
'<td><b>Password</b>\n'+
names+
'</table>\n';
document.body.innerHTML = body;

This could be integrated with the Browser Console script if someone has time to do it so that you do not need multiple steps.

(Now I have to permanently delete firefox-logins.json from my system!)

mai multe opțiuni

This fixed the problem. Thank you!! Hope it helps someone else.

mai multe opțiuni

I don't know how to access/write website content with multi-process enabled (i.e remote tabs) from within the Browser Console. From within the Web Console it is easy to access the content window. With multi-process disabled it is gBrowser.selectedBrowser.contentDocument.body.innerHTML from within the Browser Console.. I don't think it is worth the extra effort to setup frame script loaders and the message manager.

mai multe opțiuni

Hi cor-el, I was thinking of the old technique of building a page, converting to dataURI, then launching in a new window or tab. Like you posted in: https://support.mozilla.org/questions/967729#answer-466640

Then the sensitive data would never touch the disk, except in the cache which is easy to clear. Or would it be in history? I guess that would need to be cleaned, too.

mai multe opțiuni

If you use a data URI with all data in it then sessionstore will store the complete data URI and this includes a closed tab case, so I stopped using that a long time ago and changed to injecting the body text.

var dataURI = 'data:text/html;charset=utf-8,';
mai multe opțiuni

cor-el said

If you use a data URI with all data in it then sessionstore will store the complete data URI and this includes a closed tab case, so I stopped using that a long time ago and changed to injecting the body text.

I forgot about that problem.

mai multe opțiuni

Note that you can use the view-source: prefix (view-source:file://) in the location/address bar to get the raw code.