Closed Bug 471755 Opened 16 years ago Closed 10 years ago

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

Categories

(Web Compatibility :: Site Reports, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: camilleri.jon, Unassigned)

References

()

Details

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.
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
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.
I don't see any issues. 
I'm closing as WFM
Assignee: english-us → nobody
Status: NEW → RESOLVED
Closed: 10 years ago
Component: English US → Desktop
Resolution: --- → WORKSFORME
Product: Tech Evangelism → Web Compatibility
You need to log in before you can comment on or make changes to this bug.