Copy from console without source?

5,144 views
Skip to first unread message

Robert Mark Bram

unread,
Jan 21, 2014, 8:05:58 PM1/21/14
to google-chrome-...@googlegroups.com
Hi All,

When I copy from the console, I get the source for every line i.e. what line generated that console output. Is there a way to copy from the console without the source?

Rob
:)

Paul Irish

unread,
Jan 21, 2014, 9:50:05 PM1/21/14
to Google Chrome Developer Tools
You can use the copy() method to copy into clipboard some evaluation.

Oftentimes this works nicely:  copy( $_ )


--
You received this message because you are subscribed to the Google Groups "Google Chrome Developer Tools" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-chrome-develo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-chrome-developer-tools/3964444a-97c7-47df-b467-af20348f3532%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Robert Mark Bram

unread,
Jan 21, 2014, 10:59:22 PM1/21/14
to google-chrome-...@googlegroups.com
You can use the copy() method to copy into clipboard some evaluation.

Oftentimes this works nicely:  copy( $_ )

Hmm.. copy( $_ ) and copy() just put "undefined" in the clipboard. Not sure I understand how to use this.

Paul Irish

unread,
Jan 22, 2014, 1:06:43 PM1/22/14
to Google Chrome Developer Tools
Sorry, it takes the primary argument and copies it to the clipboard.

copy( location )
copy( { prop : "value"} );

$_ is a reference to the last evaluation in the console:



--
You received this message because you are subscribed to the Google Groups "Google Chrome Developer Tools" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-chrome-develo...@googlegroups.com.

Robert Mark Bram

unread,
Jan 22, 2014, 9:52:00 PM1/22/14
to google-chrome-...@googlegroups.com


On Thursday, 23 January 2014 05:06:43 UTC+11, Paul Irish wrote:
Sorry, it takes the primary argument and copies it to the clipboard.

copy( location )
copy( { prop : "value"} );

$_ is a reference to the last evaluation in the console:

I see..  that's useful if you want a text representation of something (DOM element or named variable), but not really helpful for capturing output to the console, which is what I am after.

Unless you replaced all console.log statements with something like blah+=".." and then at the end ran copy(blah), which is all a bit painful. Worse is that these commands cannot be run in a snippet - only the console.


PhistucK

unread,
Jan 23, 2014, 1:54:44 AM1/23/14
to Google Chrome Developer Tools
Well, a not so easy way is to open the Developer Tools for the Developer Tools and add display: none to the class that all of the source links have and then copy using the regular means.


PhistucK


--
You received this message because you are subscribed to the Google Groups "Google Chrome Developer Tools" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-chrome-develo...@googlegroups.com.

Robert Mark Bram

unread,
Jan 23, 2014, 2:10:29 AM1/23/14
to google-chrome-...@googlegroups.com

On Thursday, 23 January 2014 17:54:44 UTC+11, PhistucK wrote:
Well, a not so easy way is to open the Developer Tools for the Developer Tools and add display: none to the class that all of the source links have and then copy using the regular means.
 
I actually tried to inspect element on the console until a little voice at the back of my head started singing "got ya!".. :)
 

PhistucK

unread,
Jan 23, 2014, 2:38:21 AM1/23/14
to Google Chrome Developer Tools
It is possible, just not that easily.
Undock the Developer Tools and press Control + Shift + J.

'Developer Tools on the Developer Tools' is cool, dude. ;)


PhistucK


--
You received this message because you are subscribed to the Google Groups "Google Chrome Developer Tools" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-chrome-develo...@googlegroups.com.

Enissay

unread,
Jun 29, 2015, 1:22:53 AM6/29/15
to google-chrome-...@googlegroups.com
Hi Robert, did you find any easy way to achieve what your were after since then ? I'm interested in it too :>

Robert Mark Bram

unread,
Jun 29, 2015, 2:33:43 AM6/29/15
to google-chrome-...@googlegroups.com
No.

@PhistucK's idea was to open Console on the Console and modify the CSS to hide the source+line number message. You can do this:
- Click on console.
- Control+shift+j to open a console on the console.
- Control+shift+f to open cross file search. 
- Search for class name: .console-message-url
- You can click on the result that should open consoleView.css.
- Change the CSS to give it display:none.
- BAM - the messages are gone!
- Except when you copy and paste, hidden content still exists and is still copied.. 

Next thing I thought about was using Javascript/jQuery to delete those nodes.

Robert Mark Bram

unread,
Jun 29, 2015, 2:35:11 AM6/29/15
to google-chrome-...@googlegroups.com
Next thing I thought about was using Javascript/jQuery to delete those nodes.

And that doesn't work either. $(".console-message-url") brings back null.

So I just copied the lot, pasted into my fave text editor and used a regex to remove the source lines.

Rob
:)

Kon Siri

unread,
Dec 3, 2019, 4:20:42 AM12/3/19
to Chrome DevTools
Now it's year 2019 appoaching 2020 but I still face the same problem. I have tried all ways above but still can't resolve the problem.(except using text editor and a regex)
Require is simple but necessary: how to copy console outputs without source info (the info on the right side)
Anyone has good idea?

在 2015年6月29日星期一 UTC+8下午2:35:11,Robert Mark Bram写道:

PhistucK

unread,
Dec 3, 2019, 4:22:33 AM12/3/19
to Google Chrome Developer Tools
I guess it is not necessary enough to justify an option. I do not think I heard this request other than on this thread (only three people are loudly looking for it, apparently).

PhistucK


--
You received this message because you are subscribed to the Google Groups "Chrome DevTools" group.

To unsubscribe from this group and stop receiving emails from it, send an email to google-chrome-develo...@googlegroups.com.

Claudio DeSouza

unread,
Dec 3, 2019, 12:23:12 PM12/3/19
to google-chrome-...@googlegroups.com
--
You received this message because you are subscribed to the Google Groups "Chrome DevTools" group.

To unsubscribe from this group and stop receiving emails from it, send an email to google-chrome-develo...@googlegroups.com.

Zynyz

unread,
Jan 6, 2020, 3:53:45 AM1/6/20
to Chrome DevTools
On Tuesday, December 3, 2019 at 1:22:33 AM UTC-8, PhistucK wrote:
I guess it is not necessary enough to justify an option. I do not think I heard this request other than on this thread (only three people are loudly looking for it, apparently).

Hi - you can make that 4 people now :) I would love to have this feature.

Andy

unread,
Feb 17, 2020, 12:00:45 PM2/17/20
to Chrome DevTools
Make me number 5! it would be awesome to be able to toggle the source.

Also being able to open 'Developer Tools on the Developer Tools' still blows my mind. With this being possible, you could remove the source information from the dev tools by using the other dev tools console.

[].forEach.call(document.querySelectorAll(".console-message-anchor"), function(e) { e.parentNode.removeChild(e); });
Reply all
Reply to author
Forward
0 new messages