can I prevent Chrome from truncating strings in the dev console?
Become or hire the top 3% of the developers on Toptal https://topt.al/25cXVn
--
Track title: CC F Haydns String Quartet No 53 in D
--
Chapters
00:00 Question
00:36 Accepted answer (Score 69)
01:32 Answer 2 (Score 30)
01:48 Answer 3 (Score 6)
02:12 Answer 4 (Score 4)
02:28 Thank you
--
Full question
https://superuser.com/questions/699922/c...
Accepted answer links:
[image]: https://i.stack.imgur.com/toeFP.png
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#googlechrome
#avk47
--
Track title: CC F Haydns String Quartet No 53 in D
--
Chapters
00:00 Question
00:36 Accepted answer (Score 69)
01:32 Answer 2 (Score 30)
01:48 Answer 3 (Score 6)
02:12 Answer 4 (Score 4)
02:28 Thank you
--
Full question
https://superuser.com/questions/699922/c...
Accepted answer links:
[image]: https://i.stack.imgur.com/toeFP.png
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#googlechrome
#avk47
ACCEPTED ANSWER
Score 69
I recently discovered that the Chrome dev tools has a copy
function which copies to clipboard - without truncation! Handily it also serializes objects to JSON and DOM elements to HTML, straight to the clipboard.
copy(someLongString); // no truncation!
copy({ foo : true }); // JSON
copy(someDOMElement); // HTML
Since I was trying to copy a long string to clipboard for analysis elsewhere, this served my needs perfectly
Edit in 2021: Seems Chrome now adds a handy button in console for copying long strings:
Here's some code to test the feature:
var str = "";
// generate 30kb hex string
for(var i = 0; i < (1024 * 30); i++) {
str += (i % 16).toString(16)
};
// just so we know it copied the whole thing
str += "END";
ANSWER 2
Score 6
This behavior still exists in Chrome Version 37.0.2062.103.
You can get around this while debugging by using: document.write('My Really Long Debug Text');
ANSWER 3
Score 4
I use the following:
var text = 'a really long string';
window.prompt("Copy to clipboard", text);
then copy the text from the edit field.
ANSWER 4
Score 3
Upgrade Chrome to version 32 which no longer does this, as shown by this picture: