News:

Wondering if this will always be free?  See why free is better.

Main Menu

Select and copy javascript

Started by spiros, February 24, 2019, 07:06:13 AM

Previous topic - Next topic

spiros

Currently, if one adds the code tag, the smfSelectText(this); bit allows to select the code. Could this be improved so that it copies too?

Arantor

The clipboard API is very fussy about what it allows you to do because code being allowed to copy to the clipboard carries security implications. Most of the time this is offered by Flash based fallbacks, so you can see how useful that's going to be...


Arantor

If Google Docs can't do it consistently in a major browser and puts up a prompt telling people to use Ctrl-C on their keyboard (as in Firefox)... I doubt this really works as well as advertised.

Even putting that aside it cannot be added to smfSelectText in 2.0 as this is needed for other routines and one of the huge deals of the clipboard API is that you can't call it directly from a function but have to trigger it only in an event handler for security reasons.

spiros

#4
It works just fine in Adsense and http://goo.gl :)

Advertisement: