473,406 Members | 2,769 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,406 software developers and data experts.

Getting a Javascript vairiable into a PHP vairiable automatically without clicking a link or button?

J
Hi All,
I have a quick question,
I am making a little script that shows users how easy it is to have there
clipboards read.

I would like to capture my users clipboard (plain text only) and then
AUTOMATICALLY send them to a page displaying there contents, I want to get
the +content+ put into a $content vairiable for easier manipulation in PHP.

As javascript is client side and PHP serverside, i need to submit the form
somehow, and this is what I have come up with (below)...
Any other ideas would be cool, and I then pick up the values from Javascipt
and then GET the content and put it into a vairiable in PHP, but this means
clicking a link or button.
Do you now of an automatic way of doing this? maybe a auto refresh?? I dont
know??? will it work?

Thanks all,
J
------------------------------ File ---------------------------
<html><head></head><body>
<?
if (content){
$string = $_GET['content'];
echo $string;
}
?>
<SCRIPT LANGUAGE='JavaScript'>
<!-- //
var content = clipboardData.getData("Text");
document.write('<a href="jim.php?content='+content+'">Click here</a>');
var content=content;
// -->
</SCRIPT>
</body></html>
Jul 23 '05 #1
5 1519
J wrote:
Hi All,
I have a quick question,
I am making a little script that shows users how easy it is to have there
clipboards read.


Ha, ha ha, ha ha ha, ROFLMAO ... :-x

Can you *really* do this on Windows/IE? Reliably?

He he, haw haw, gosh, somebody stop me!

I'll absolutely guarantee that this will not work on my system!
It really is that easy.

Have a good one :-)
--
Zif
Jul 23 '05 #2
J
It does work, look into it before assuming because you don't know about it,
it doesn't exist.

Its not very reliable though, obviously they need some plain text in the
clipboard, and hopefully not any HTML or any other script, just something
like "hello, test" or something like that.

Anyway, back to my question, do you know of a way to automatically submit
the data on pageLoad?

Thanks
Jim

PS you might want to read
http://www.arstdesign.com/articles/c...rdexploit.html before commenting.

"Zifud" <Zi***@hotmail.com> wrote in message
news:gI**************@news.optus.net.au...
J wrote:
Hi All,
I have a quick question,
I am making a little script that shows users how easy it is to have there
clipboards read.


Ha, ha ha, ha ha ha, ROFLMAO ... :-x

Can you *really* do this on Windows/IE? Reliably?

He he, haw haw, gosh, somebody stop me!

I'll absolutely guarantee that this will not work on my system!
It really is that easy.

Have a good one :-)
--
Zif

Jul 23 '05 #3
Ivo
"J" wrote
I would like to capture my users clipboard (plain text only) and then
AUTOMATICALLY send them to a page displaying there contents, I want
to get the +content+ put into a $content vairiable for easier manipulation
in PHP.


If the purpose of this excercise is only the demonstration of clipboard
functionality, there is no need for PHP or a second page:

var a=clipboardData.getData("Text");
document.write( a.replace(/</g,'&lt;') );

will be plenty.
You strengthen your user's trust in you by NOT sending their clipboard
back to your server.
hth
--
Ivo


Jul 23 '05 #4
J wrote:
It does work, look into it before assuming because you don't know about it,
it doesn't exist.
Please don't top-post, read the group FAQ:

<URL:http://jibbering.com/faq/#FAQ2_3>

Its not very reliable though, obviously they need some plain text in the
clipboard, and hopefully not any HTML or any other script, just something
like "hello, test" or something like that.
I know it works on *one* particular platform with *one*
particular browser, please turn sarcasm detector to "on".

It does not work on any platform/browser combination that I use.

Anyway, back to my question, do you know of a way to automatically submit
the data on pageLoad?


The reference you quote points out the silliness of allowing a
script writer to arbitrarily access the clipboard. Point your
visitors there.

Further, you can't guarantee that there is *anything* in the
clipboard, much less something worth stealing - or even if there
is, that you can do anything useful with it.

In plain English: it is not a security hazard, it is a silliness
hazard.

Please reinstate sarcasm detector to your preferred setting...

--
Zif
Jul 23 '05 #5
J
Yeah I suppose your right.
Ta.

"Ivo" <no@thank.you> wrote in message
news:42***********************@news.wanadoo.nl...
"J" wrote
I would like to capture my users clipboard (plain text only) and then
AUTOMATICALLY send them to a page displaying there contents, I want
to get the +content+ put into a $content vairiable for easier
manipulation
in PHP.


If the purpose of this excercise is only the demonstration of clipboard
functionality, there is no need for PHP or a second page:

var a=clipboardData.getData("Text");
document.write( a.replace(/</g,'&lt;') );

will be plenty.
You strengthen your user's trust in you by NOT sending their clipboard
back to your server.
hth
--
Ivo

Jul 23 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: KenLee | last post by:
I worked on Windows application. I made a application to covert flat file to insert database. currently, I made a button to display progress bar after clicking the button. I just want to load...
8
by: chrisdude911 | last post by:
how do i add video into a javascript web page with my own custom buttons?
6
by: hemant.singh | last post by:
Hi all, I am trying to get a way by which I'll know exactly when user goes out of my site by clicking on close button in browser, So that w/e user click close button in browser, I can send a...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.