Skip to main content
4 of 6
Updated question with example
Matt
  • 26.9k
  • 13
  • 14

Copy source to clipboard

I noticed that marking, copying and pasting code snippets in StackOverflow is a bit cumbersome - even if it is only one line of code, as in the following example (there is a horizontal scrollbar - try to copy the entire line and you'll see what I mean):

enter image description here

How about adding a "Copy to clipboard" button, like it is done for example in Microsoft's MSDN and some other developer sites?

enter image description here

In this example, after clicking "allow access" once, the entire source code has been transferred to the clipboard and can now simply be pasted by using Ctrl+V into the source editor of your choice.

N.B. While this MSDN example seam to work in IE/Edge only, CodeProject does it like this, which I've tested with IE and with Chrome successfully:

enter image description here

Please consider, if some of you don't need to copy the entire code, it is still useful for many others.

Matt
  • 26.9k
  • 13
  • 14