Saturday, 8 November 2008

Javascript hacking, can't cut/paste.

« Hvad er partitionering | Main | Server oprydning »

My wife was sitting and copying some text for printing from web-sites (she don't want to print the full page with all the layout). However, some web-sites try to prevent people from copy'n'pasting their "original content", so they have disabled selection with Javascript.

In order to get around this, a small piece of "reverse" Javascript can easily be applied, so selection does still work.

After loading the page (for example try this), put this into the navigational toolbar, and hit ENTER to have the Javascript executed:

javascript:{document.body.style.MozUserSelect="";document.body.unselectable="off";}undefined;

That's it, now it is possible to select the text. This only works in Firefox, but in a similar way, it is easy to create Javascript to do reverse-effect for MSIE also, I just don't have MSIE here to test. If you're using greasemonkey, then you can put the snippet into there, and create @includes for all the sites you want to re-enable selection on.

Posted by sorend at 1:11 AM in Home tips

 

[Trackback URL for this entry]

Your comment:

(not displayed)
 
 
 

Live Comment Preview:

 
$BLOJSOM_CALENDAR_VTLHELPER.getCalendarRow($number)$BLOJSOM_CALENDAR_VTLHELPER.getCalendarRow($number)$BLOJSOM_CALENDAR_VTLHELPER.getCalendarRow($number)$BLOJSOM_CALENDAR_VTLHELPER.getCalendarRow($number)$BLOJSOM_CALENDAR_VTLHELPER.getCalendarRow($number)$BLOJSOM_CALENDAR_VTLHELPER.getCalendarRow($number)
« $BLOJSOM_CALENDAR_VTLHELPER.getCurrentMonthName() »