Allowing Access to the Windows Clipboard

AID: 1777
  • Status: Published

6100 points

  • By
  • TypeTips/Tricks
  • Posted on2009-10-14 at 21:47:59
Awards
  • Community Pick

Do you ever get that "Do you want to allow this web page to access your clipboard?" pop-up message in Windows Explorer?

fig1-1.jpg
  • 14 KB
  • Internet Explorer's clipboard warning
Internet Explorer's clipboard warning


This happens when a script on the page executes a sequence like:

var s="new clipboard text!";
window.clipboardData.setData('Text', s );
                                  
1:
2:

Select allOpen in new window


The pop-up is a security enhancement added to Internet Explorer starting with IE 7.  There is a setting under Tools/Internet Options/Security that lets you disable the warning, but the default setting is "Prompt" and I highly recommend that you leave it that way.

Why?  Because there are web sites that will read the contents of your clipboard to learn personal information (who among us hasn't copied-and-pasted a password at one time or another?) and there are many websites that will try to delete the contents of your clipboard (e.g., as a really stupid attempt to prevent you from copying images) and, worst of all, there are known exploits involving drag-and-drop operations that can get your computer infected with a virus or Trojan horse.

So leaving the setting at Prompt will warn you that something nefarious is going on in some script on that page, and you can cancel the operation and avoid that site in the future.

However...
There are times when allowing a page to access your clipboard can be convenient.  For instance, in the article Some EE-useful JavaScripts for the IE Context Menu, I provided some scripts that might save you some time and effort in posting here at Experts-Exchange.  One of the scripts copies text to the clipboard, and thus triggers the security warning.  That makes that particular script slightly less convenient to use.

Fortunately, it is possible to set IE with specific security settings when accessing specific websites; all you need to do is include EE as one of your trusted sites, and then modify the security settings for trusted sites.

1) Navigate to any web page on the trusted site
2) Select the IE menu item Tools/Internet Options
3) Click the Security tab
4) Click the Trusted Sites zone (it has a green checkmark icon)
5) Click Sites
6) Verify that the "Add this website" box has the domain name of the site you trust.
7) If the "Require server verification for (https) for all sites on this zone" checkbox is checked, clear it.
8) Click Add and then Close

fig1-2.JPG
  • 43 KB
  • Adding a "Trusted Site"
Adding a "Trusted Site"


That site is now trusted, but you also need to change the settings for trusted sites.  We are going to change just the one setting that relates to clipboard access.

1) Back in the Internet Options/Security dialog, verify that Trusted Sites is still highlighted.
2) Click the Custom level... button.
3) Scroll down to the Scripting section near the bottom (Tip: press S a few times).
4) Change Allow Programmatic clipboard access to Enable
5) Click OK and also OK the Internet Options dialog.

fig1-3.JPG
  • 18 KB
  • Allow clipboard access at trusted sites.
Allow clipboard access at trusted sites.



That's all there is to it.  Now when you are viewing any page on that site, you will not be prompted with the "Do you want to allow this web page to access your clipboard?" warning.

Obvious, But Obligatory Warning:

!!! If you don't trust a site, don't put it on your Trusted Sites list !!!

Note to EE Article Authors:
Putting Experts-Exchange on your "Trusted Sites" list will avoid an irritating prompt that appears in the "Write Your Article" page when you click the "Create Hyperlink" button in the article editing window.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
If you liked this article and want to see more from this author,  please click the Yes button near the:
      Was this article helpful?
label that is just below and to the right of this text.   Thanks!
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

    Comments

    Expert Comment

    by: grtraders on 2009-12-10 at 22:27:51ID: 6508

    I voted yes. Nice Article.

    Ravi.

    Add your Comment

    Please Sign up or Log in to comment on this article.

    Loading Advertisement...

    Top Internet Explorer Experts

    1. ged325

      2,000

      0 points yesterday

      Profile
      Rank: Genius
    2. BillDL

      2,000

      0 points yesterday

      Profile
      Rank: Genius
    3. dlmille

      2,000

      0 points yesterday

      Profile
      Rank: Genius
    4. gerhardub

      2,000

      0 points yesterday

      Profile
    5. Geisrud

      2,000

      0 points yesterday

      Profile
      Rank: Guru
    6. sjklein42

      2,000

      0 points yesterday

      Profile
      Rank: Sage
    7. tapiwab

      2,000

      0 points yesterday

      Profile
    8. cwstad2

      2,000

      0 points yesterday

      Profile
      Rank: Master
    9. COBOLdinosaur

      1,600

      0 points yesterday

      Profile
      Rank: Genius
    10. Scissors85

      1,500

      0 points yesterday

      Profile
      Rank: Master
    11. Eyal

      1,000

      0 points yesterday

      Profile
      Rank: Wizard
    12. arthurmnev

      1,000

      0 points yesterday

      Profile
    13. jcimarron

      1,000

      0 points yesterday

      Profile
      Rank: Genius
    14. ThaVWMan

      1,000

      0 points yesterday

      Profile
      Rank: Guru
    15. JillofallTradesMistressofNone

      1,000

      0 points yesterday

      Profile
    16. Designbyonyx

      1,000

      0 points yesterday

      Profile
      Rank: Wizard
    17. ubound

      693

      0 points yesterday

      Profile
      Rank: Master
    18. Zouleous

      507

      0 points yesterday

      Profile
      Rank: Master
    19. CCSOFlag

      400

      0 points yesterday

      Profile
      Rank: Guru
    20. dstewartjr

      300

      0 points yesterday

      Profile
      Rank: Genius
    21. LeeOsborneUK

      140

      10 points yesterday

      Profile
      Rank: Wizard
    22. Motaba

      100

      0 points yesterday

      Profile
    23. egl1044

      90

      10 points yesterday

      Profile
      Rank: Genius
    24. pcfreaker

      90

      0 points yesterday

      Profile
      Rank: Guru
    25. DanRollins

      70

      0 points yesterday

      Profile
      Rank: Genius

    Hall Of Fame