Javascript Clipboard Access in Firefox

Published 7 January 2009 16:08 by Ross in Javascript

Now that Firefox supports content editable divs I have recently been interested in implementing a cross browser WYSIWYG editor based on content editable divs allowing in context editing in both IE and Firefox. Unfortunatley, by default Firefox will not allow Javascript to access the clipboard which actually makes sense for security purposes. However, access can be enabled by following theinstructions below:

For Firefox:

  1. Quit Firefox. If you have Quick Launch running (in Windows, an icon in the toolbar), quit that too.
  2. Find your Firefox profile directory. On Windows, this is often located in

    C:\Documents and Settings\<Windows login>\Application Data\Mozilla\Firefox\Profiles\<one folder>.

  3. Open the user.js file from that directory in a text editor. If there's no user.js file, create one.
  4. Add these lines to user.js:

    	user_pref("capability.policy.policynames", "allowclipboard");
    	user_pref("capability.policy.allowclipboard.sites","http://www.inflecto.co.uk");
    	user_pref("capability.policy.allowclipboard.Clipboard.cutcopy", "allAccess");
    	user_pref("capability.policy.allowclipboard.Clipboard.paste", "allAccess");
    	

    *Change the url "http://www.inflecto.co.uk" to where you want to enable this function.

  5. Save the file, and restart Firefox. The Clipboard buttons should now function.

If you want to allow multiple urls to access the Paste operation, separate the urls with a space.


   |    Kick It on DotNetKicks.com    |    Delicious Delicious |    |    E-mail

Comments

Add comment


 

  Country flag





Ross's Blog

Ross Mason is a software devloper who lives and works in Sheffield, UK.