473,216 Members | 1,292 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,216 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 2382
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: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.