msdn.microsoft.com - 'Copycode' Javascript does not copy text to Windows clipboard

RESOLVED WORKSFORME

Status

Tech Evangelism
Desktop
RESOLVED WORKSFORME
9 years ago
3 years ago

People

(Reporter: Jon, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

9 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5 (.NET CLR 3.5.30729)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5 (.NET CLR 3.5.30729)

Within various MSDN webpages, MS implement a script that copies code to the Windows Clipboard.  Whilst this seems to work fine within IE7, this does not work within Mozilla 3.0.5.

Example of java script
javascript:CopyCode('ctl00_rs1_mainContentContainer_ctl20CSharp');


Reproducible: Always

Steps to Reproduce:
1. Browse to http://msdn.microsoft.com/en-us/library/cc546557.aspx
2. Scroll down until there is some code, and select Copy Code on the top left.

Actual Results:  
Nothing happens

Expected Results:  
Code should be copied to the windows clipboard.

Comment 1

9 years ago
Error: window.clipboardData is undefined

function CopyCode(elemName){var obj=document.getElementById(elemName);window.clipboardData.setData("Text",obj.innerText)}

The function in question uses "window.clipboardData" which is an IE-specific feature. Confirming and sending over to TE.
Assignee: nobody → english-us
Status: UNCONFIRMED → NEW
Component: General → English US
Ever confirmed: true
OS: Windows XP → All
Product: Firefox → Tech Evangelism
QA Contact: general → english-us
Hardware: x86 → All
Summary: 'Copycode' Javascript does not copy text to Windows clipboard → msdn.microsoft.com - 'Copycode' Javascript does not copy text to Windows clipboard

Comment 2

7 years ago
well, it would be great to be able to put stuff in the clipboard via javascript (with a doorhanger asking for permission, of course) because of these use cases:

1. alice doesn’t have flash installed and wants to e.g. copy code snippets she found on the web into her clipboard (syntaxhighlighter and may other “cross browser scripts” has this feature, but use flash for firefox). she can’t.

2. bob wants to know when pages want to copy text into his clipboard and allow it when he triggered the action intentionally. firefox, putting privacy at the first place would allow this, flash doesn’t. (doorhanger: allow once)

3. craig uses kde and has a clipboard manager (klipper), so he doesn’t care how often his clipboard content is changed and he doesn’t want to be bothered with a popup asking for the permisson more than once. (doorhanger: allow always)

summary: since most people have flash installed, there is a security gain if firefox handles copying to the clipboard. for people without flash, there is no way of having the functionality yet.

Comment 3

3 years ago
I don't see any issues. 
I'm closing as WFM
Assignee: english-us → nobody
Status: NEW → RESOLVED
Last Resolved: 3 years ago
Component: English US → Desktop
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.