473,385 Members | 2,005 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

javascript click and copy

is there any way to add event to the mozilla firefox where the selected text is copied into clipboard with jus a click.. its like u click on the text and the text is selcted , the selected text has to be copied to the clipboard with a just a click rather than using ctr+c ????
Oct 1 '08 #1
6 2390
Plater
7,872 Expert 4TB
Well javascript can do that. I will move your question there.
MODERATOR
Oct 1 '08 #2
acoder
16,027 Expert Mod 8TB
This won't be possible unless you have privileges and the user allows them too.

Is this for the Web?
Oct 1 '08 #3
Plater
7,872 Expert 4TB
This won't be possible unless you have privileges and the user allows them too.

Is this for the Web?
You need special privledges for javascript to access your clipboard?

http://www.google.com/search?source=...ript+clipboard
Oct 1 '08 #4
acoder
16,027 Expert Mod 8TB
Yes - Granting JavaScript access to the clipboard.
Oct 1 '08 #5
gits
5,390 Expert Mod 4TB
yes ... thanks god ;) ... sometimes i really don't want someone to read my clipboard ... for example i would have copied email-addresses or other sensitive information to it and in case a webpage could just grab it it would be a serious security-issue ...

kind regards
Oct 1 '08 #6
rnd me
427 Expert 256MB
there are workarounds.

flash can do it, and likely from a hidden frame.

as long as flash as enabled, i wouldn't fee too safe,

i noticed a site that had a button that said "place on clipboard".
i laughed and clicked it.
the joke was on me when i got to notepad.

EDIT:

here is working code i cleaned up for firefox:


Expand|Select|Wrap|Line Numbers
  1.  
  2. function copy(str) {
  3.    var D=document;
  4.     if(!copy.div) { copy.div = D.createElement('div'); D.body.appendChild(copy.div);  }
  5.  
  6. flashVar = "Q1dTB3kAAAB4nKtgYI1nYOBfwMDAw8jgzPT//3975lAGBoYOdQYWhu\
  7. SczIKk/MSiFIac1Lz0kgyG4MriktRchuLUEme41DQmBg4GGRDJ6Cc0l4lBAibCzsDO\
  8. CDSJgwksyRwkzuAA5AIAd7oY/w==";
  9.  
  10. copy.div.innerHTML =  '<embed src="'+flashVar+'" FlashVars="clipboard='+encodeURIComponent(str) +
  11.     '" width="0" height="0" type="application/x-shockwave-flash"></embed>';
  12. }
  13.  
  14.  
it cannot read the clipboard, so i don't feel too bad about posting it.
Oct 1 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Sarah | last post by:
Hi! I have perhaps a strange question... I have a javascript that activates on a right click and shows the user a little menu of links. However, by doing so, it disables the users ability to...
9
by: bert76 | last post by:
can anyone suggest a couple of websites providing *compatible* javascript? of course there is http://javascript.internet.com/ http://javascriptkit.com/ and the likes, but time and again you have...
2
by: Joe Fallon | last post by:
I can add items to my dropdown list using javascript like this: cbo.length = j+2; cbo.options.text = "Some Text"; cbo.options.value = "MyValue"; cbo.options.text = "Some Other Text";
4
by: bboyle18 | last post by:
Hi, I am working with a table sorting script which can be found here http://www.workingwith.me.uk/articles/scripting/standardista_table_sorting This script works very nicely, but when there is a...
24
by: firstcustomer | last post by:
Hi, Firstly, I know NOTHING about Javascript I'm afraid, so I'm hoping that someone will be able to point me to a ready-made solution to my problem! A friend of mine (honest!) is wanting to...
5
by: Newbie Coder | last post by:
Hello all I have 3 functions in a javacrip file (MyScript.js), which is added to an ASP.NET 2.0 project 1) no right-click 2) no select text (copy...) 3) History.Back()' How do I call...
2
by: zakhirn | last post by:
Hello, I have a search function that is reading companies from a database via ASP and spitting out the results. I have various fields of each company in variables and I want to be able to create...
1
by: Thom.Burnett | last post by:
I want to change an action based on values in a form. The following javascript code works great in Firefox but not Internet Explorer. With IE the default action is always used by submit. Any...
4
by: Smudly | last post by:
I am trying to write a simple Ajax application using SUSE 10.2, Apache, PHP and Javascript. I want to click on a table header and do some processing to update the table. i have a function...
1
by: jerunyon | last post by:
Recently I noticed that if you "right click" and "open link" on my site, you bypass the javascript code that fires "onclick". I have several pages that fall victim to this, and I could probably...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.