How to highlight and copy text on sites that block it - gHacks Tech News

How to highlight and copy text on sites that block it

Every now and then I come across sites on the Internet that prevent you from copying some or all of the text displayed to the clipboard, or even selecting it in first place using the mouse or keyboard.

I noticed this on a bank's site recently for example where I was not allowed to copy the bank account number to the clipboard.

This guide looks at methods to overcome the limitation put in place by websites on the Internet. But first, why do sites implement these restrictions in first place?

While reasons are provided by companies and individuals who implement the functionality on their web properties, the most likely reason is some form of copy protection.

Method 1: Turn off JavaScript

javascript

Most websites use JavaScript to block mouse functionality. If you turn off JavaScript on the site temporarily or even permanently, you will be able to copy text displayed on it using the mouse.

Some websites rely on JavaScript on the other hand which means that you may run into issues doing so. Some may even refuse to display at all when JavaScript is turned off.

  • Firefox users can press F12, there on the preferences icon to disable JavaScript in the menu that opens.
  • Chrome users can disable JavaScript in the Content settings: chrome://settings/content
  • Internet Explorer users can turn off JavaScript in Internet Option > Security > Zone > Custom Level > Active Scripting
  • Opera users can disable JavaScript under Websites in the Opera settings: opera://settings/

Extensions like NoScript can be useful in this regard as they block the execution of scripts as well.

Method 2: The source

source

Another option that you have is to display the source code of the website you are on. Since it is displayed in a plain text editor it is possible to copy anything from it without restriction.

Simply press Ctrl-u while you are on the site to display its source code. This works in most browsers including Firefox, Chrome and Internet Explorer.

It is still necessary to find the text or content that you are looking for in the source. Use Ctrl-f to jump directly to it.

There you may also find links to images and other contents that you could not save or copy.

Method 3: Extensions and scripts

The third and final option is most suitable if you encounter sites regularly that prohibit right-click use or text copying when you are on them, and if the methods outlined above don't work or are not really suitable.

RightToClick for Firefox disables JavaScript annoyances such as forbidding right-clicks or text selection on sites.

RightToCopy for Chrome offers similar features.

You find numerous extensions for these two browsers that remove annoyances on websites.

Summary
How to highlight and copy text on sites that block it
Article Name
How to highlight and copy text on sites that block it
Description
Some sites block text selection and copying using JavaScript. This guide looks at three methods that allow you to copy text on these sites anyway.
Author




  • We need your help

    Advertising revenue is falling fast across the Internet, and independently-run sites like Ghacks are hit hardest by it. The advertising model in its current form is coming to an end, and we have to find other ways to continue operating this site.

    We are committed to keeping our content free and independent, which means no paywalls, no sponsored posts, no annoying ad formats (video ads) or subscription fees.

    If you like our content, and would like to help, please consider making a contribution:

    Comments

    1. Niks said on December 24, 2014 at 11:12 am
      Reply

      Disabling javascript can also help in copying/saving images where right click is disabled . I use this method to download images from instagram .

    2. Paul(us) said on December 24, 2014 at 11:39 am
      Reply

      Martin, Thanks for again a really interesting to read and easy to understand article.

      Niks is mention this above but not answering all of main question so here is main question to you Martin:
      The only question your article leaves me with is or the above mentioned programs and also your guide
      to the actions I can follow also works with saving pictures?
      I often encounter sites who forbid me to save a/the picture(‘s) from there website so I am wondering
      are there outer methods for saving pictures from those sites?
      Or is this method working whit who I can save pictures from websites who forbid me to do so?

      1. Martin Brinkmann said on December 24, 2014 at 11:42 am
        Reply

        Yes disabling JavaScript will do that as well, provided that the images are still displayed after you disable it.

      2. Doc said on December 24, 2014 at 5:45 pm
        Reply

        You can always view *all* images used in a webpage (except those displayed by plugins like Flash) in Firefox by choosing Tools -> Page Info -> Media tab. This will also allow you to save any images.

    3. willnotbepublished said on December 24, 2014 at 11:57 am
      Reply

      Sometimes pressing shift, ctrl or alt is enough.

    4. toodess said on December 24, 2014 at 11:57 am
      Reply

      another method I use,
      just create a new bookmark, name it as you want and paste this line as URL :
      javascript:void(document.ondragstart=document.body.ondragstart=null,document.oncontextmenu=document.body.oncontextmenu=null,document.onselectstart=document.body.onselectstart=null,document.onclick=null,document.body.onclick=null,document.onmousedown=document.body.onmousedown=null,document.onmouseup=document.body.onmouseup=null,document.onbeforecopy=document.body.onbeforecopy=null,document.onbeforecut=document.body.onbeforecut=null,document.oncopy=document.body.oncopy=null);

      usualiy it works well with Firefox, I don’t have to disable javascript, just send the instruction to re-enable features supposed locked on the Web page

    5. Tom Hawack said on December 24, 2014 at 12:40 pm
      Reply

      Here I’ve bundled two scripts found on the Web into one and built a bookmarklet called whenever a page refuses right-click and/or refuses text copy. I haven’t yet encountered a page where the bookmarklet would be ineffective. Works with Firefox, elsewhere I don’t know.
      Bookmarklet’s script : http://pastebin.com/tYiV0UYZ

      Copy the script, create a new bookmark, give it as url the script, as name as you wish, call that bookmark on those naughty pages (for those who ignore what a bookmarklet is)

    6. Dwight Stegall said on December 24, 2014 at 2:59 pm
      Reply

      Reenable Right Click.

      javascript:/*Anti%20No%20Right%20Click.%20Copyright%20(C)%20CodeHouse.com,%202004*/function%20kill(doc){doc.onmousedown=doc.onmouseup=doc.oncontextmenu=doc.onselectstart=doc.ondragstart=function(){return%20true};if(window.releaseEvents){releaseEvents(Event.MOUSEDOWN|Event.MOUSEUP);}}onerror=function(){return%20true};kill(document);if(frames.length){for(i=0;i<frames.length;++i){kill(frames[i].document);}}else{kill(document);}

    7. Pants said on December 24, 2014 at 3:59 pm
      Reply

      I’ve never bothered to use it, but its been in my marklet folder on my toolbar for about 2 years

      javascript:function%20kill(d){d.onmousedown=d.onmouseup=d.oncontextmenu=d.onselectstart=d.ondragstart=function(){return%20true;};}try{kill(document);for(var%20j=0;F=frames[j];++j)kill(F.document);}catch(e){}

    8. onedeafeye said on December 24, 2014 at 7:30 pm
      Reply

      One method that has never failed me is to take a screenshot.

      1. Martin Brinkmann said on December 24, 2014 at 8:39 pm
        Reply

        Works, unless you need the text and not the information. Thanks!

        1. stilofilos said on December 27, 2014 at 9:34 am
          Reply

          There is a nice tool to convert images to text : Free OCR from http://www.paperfile.net/
          Does a great job, but needs .Net v2 and the Tesseract language pack for the language used.

          You can also save the page as a PDF, and open that one in PdfXchange viewer, which in recent versions has a very efficient and nicely working ocr tool to export selected text.

          Besides, using Firefox, i often use an addon that saves a copy of the page as it is ,apparently without scripts. From that, you can just copy whatever you want.
          Find it at https://addons.mozilla.org/en-US/firefox/addon/mozilla-archive-format/?src=search

    9. Dylan Groves said on December 24, 2014 at 8:45 pm
      Reply

      In Firefox shift+right click will always get the default menu. I learned this by accident when I was trying to make shift+right click do something and it just wouldn’t work. Not sure if Chrome has something similar.

      1. Tom Hawack said on December 24, 2014 at 9:24 pm
        Reply

        I learned something. Interesting. Many application shortcuts are unknown by many users. Shift+Right_Click on Firefox (at least) always brings up the default menu. Good to know.

        1. Martin Brinkmann said on December 24, 2014 at 9:39 pm
          Reply

          That’s really good to know. Great tip!

    10. belwanj said on December 24, 2014 at 9:15 pm
      Reply

      Change browser View/Page option-Style …. to “No Style”

      Also, often it is only the on screen visual ‘highlighting’ that is disabled — you can still highlight/copy text as normal with mouse/keyboard… you just can’t see the color/shade change on the text you select.

    11. Belga said on December 24, 2014 at 11:05 pm
      Reply

      What bothers me the most are the pages where it is not possible to use bookmarklets in the kind of “Printwhatyoulike” or “Printliminator” to create pdf-files to archive.
      All these methods don’t help in this case.
      Thanks for the tips anyway.

      1. Tom Hawack said on December 24, 2014 at 11:25 pm
        Reply

        Basically a bookmarklet should always operate correctly if javascript is not disabled. But there are some pages which have been crafted in such a way that they cannot be scanned from another site, indeed. I don’t know how they manage but I’ve noticed it, very few times, when saving a page with printfriendly.com or a dedicated bookmarklet. Also, some pdf-makers don’t handle https pages.

      2. Klaas Vaak said on February 24, 2018 at 12:30 pm
        Reply

        Reader View obviates the use of Printliminator.

    12. Ron said on December 25, 2014 at 3:39 am
      Reply

      Thanks for the tip about “Ctrl-u.” It may come in handy sometime.

    13. david chase said on December 26, 2014 at 4:11 am
      Reply

      simply use faststone capture to copy, print or save anything you want to on any site / desktop anywhere …no hassle no problem no magic…easy easy

    14. Ryko said on June 28, 2015 at 2:27 am
      Reply

      thanks..really appreciate it! good job!

    15. wings said on November 4, 2015 at 10:55 pm
      Reply

      Thanks a lot! Method 1 worked. :D

    16. Laks said on January 28, 2016 at 7:54 am
      Reply

      Thanks! Method 1 worked for me!

    17. Mischa said on February 14, 2016 at 3:26 pm
      Reply

      How to copy content of a website that won’t accept the disabling of Javascript?

      1. Martin Brinkmann said on February 14, 2016 at 3:31 pm
        Reply

        Disable JavaScript in the browser. Or, save the page, and copy it then.

    18. Roby said on April 11, 2016 at 7:40 pm
      Reply

      Ctrl + U :) Thanks!

    19. David said on May 4, 2016 at 9:07 pm
      Reply

      You can use GT Text (softocr.com). Is a totally free program for windows. And just press ALT+C and with OCR you have the blocked text.

    20. Ahmad Ahmadli said on July 2, 2016 at 10:55 am
      Reply

      In search machine or anywhere click right on website and choose print and you will able to copy

    21. Nasim said on August 16, 2016 at 8:36 am
      Reply

      Thanks Bro

    22. Tamara Aller said on August 20, 2016 at 11:41 am
      Reply

      Method 3 for Chrome did it for me.

      Thank you for helping me to do my job better and more efficiently. God bless.

    23. loliconer said on September 22, 2016 at 8:49 pm
      Reply

      u can try reader view mode in firefox its easy

      1. Klaas Vaak said on February 24, 2018 at 12:31 pm
        Reply

        There are web pages that disable that feature.

    24. Carmin said on October 4, 2016 at 9:59 am
      Reply

      Thank you very much!! Really helpful and saves me a lot of time.

    25. Anil Tiwari said on October 27, 2016 at 2:33 am
      Reply

      Thanks Man !!!

    26. Robert Miles said on November 14, 2016 at 10:25 pm
      Reply

      I *really* hate it when sites do this to me. Any web publisher who is attempting to plagiarize will already know how to bypass this, and anyone who doesn’t can search for a solution in 30 seconds. All it serves to do is make me feel like an idiot when all I’m really trying to do is select a few words to use as a search term so I don’t have to manually type it. I ended up using RightToClick as an alternative to jumping into the inspector every time.

    27. Mboo Kubwa said on November 27, 2016 at 9:52 pm
      Reply

      This is priceless! Thank you all

    28. Ratna said on December 21, 2016 at 10:25 am
      Reply

      Hi Martin,

      Nice article and it is very useful!

    29. angela said on January 28, 2017 at 10:01 pm
      Reply

      I used to use the righttocopy extension but the person took it off. What else can I use for an extension on firefox to copy and paste sites that have disabled it?

    30. greg said on January 30, 2017 at 7:33 pm
      Reply

      in firefox one can use “reader mode” like described here http://useitsmart.com/copy-text-site-blocks-coping

    31. karel said on March 2, 2017 at 12:38 pm
      Reply

      This method worked for me on chrome:

      Try to print page, then you can select the text in the preview window.

      1. Ace said on April 14, 2018 at 4:58 pm
        Reply

        Thanks for this tips.. only way for me to copy some info on a page :D

      2. Ace said on April 14, 2018 at 5:00 pm
        Reply

        Thanks alot. Finally this worked for me to copy some text on page . You saved my day

    32. Anonymous said on April 10, 2017 at 7:38 pm
      Reply

      Thanks a ton!

    33. Shri said on April 23, 2017 at 11:59 am
      Reply

      thanks brotha!

    34. Akshay said on May 11, 2017 at 10:20 am
      Reply

      Thank you Martin. It totally helped me for my project work.

    35. Dhruv Patel said on May 11, 2017 at 9:12 pm
      Reply

      Thanks a lot…

    36. Any said on July 13, 2017 at 12:44 am
      Reply

      Make a bookmark and use this as URL:
      javascript:void(document.oncontextmenu=null); document.body.onselectstart = function() {return true;};

      Tested with Chrome.

    37. Ankit said on October 15, 2017 at 5:49 am
      Reply

      Wastage of time.. literally of no use.

    38. jason said on October 29, 2017 at 10:26 am
      Reply

      it works , thanks

    39. DovahkiinSenpai said on November 19, 2017 at 11:26 am
      Reply

      Sometimes, if you can highlight the text then you have the option to search Google for the text you’ve highlighted and then click back into the searchbar and your search history should pop up with the last searched item being the text you’ve highlighted on the previous website.

    40. kedaxx said on November 29, 2017 at 9:32 pm
      Reply

      RightToClick Chrome extension worked perfectly for me..

    41. Cici Grasa said on December 13, 2017 at 1:40 am
      Reply

      The turning off javascript didn’t work for me…

    42. Musa said on January 24, 2018 at 11:20 am
      Reply

      Hello, I have a browser made by Javascript disabling copying from it, how can I copy it. It’s not among the browsers you listed above. Can you help please

    43. n0h4ckz said on February 11, 2018 at 6:06 pm
      Reply

      thx helped me a lot

    44. Matyas said on March 29, 2018 at 6:11 am
      Reply

      One word, LEGEND!

    Leave a Reply