safari supressing textarea copy/drag

T

Tom

I don't have access to an apple so when visiting a friend this weekend
i tried my script on 2 Apples my friend had.

My page has a form including a textarea that gets the results. Then my
JavaScript uses select all, sets the textarea to have the focus, and
sets it to read only.

On one of the two Apples (the newer one), Safari seemed to be
preventing both copying the selected text to the clipboard and/or
dragging the selected text to another window.

Was this do to some setting in Safari?

Tom
 
R

RobG

I don't have access to an apple so when visiting a friend this weekend
i tried my script on 2 Apples my friend had.

My page has a form including a textarea that gets the results. Then my
JavaScript uses select all, sets the textarea to have the focus, and
sets it to read only.

On one of the two Apples (the newer one), Safari seemed to be
preventing both copying the selected text to the clipboard and/or
dragging the selected text to another window.

Mac OS X does not, in general, support drag-and-drop of text, nor does
Safari. They do support drag and drop of various objects such as URLs
and images.
Was this do to some setting in Safari?

It would help if you:

1. Supplied a minimal example of the code that produces the effect
2. Advised the versions of OS X or Safari tested
3. Told us how you tried to copy the text (e.g. using Edit->Copy, Ctrl
+v, right click, and so on)

and any other details you feel might be relevant.

The following "works" fine in Safari 4.0.3 (Mac OS X 10.6.1):

<form>
<textarea id="ta0">Here is some text</textarea>
<input type="button" value="Do stuff" onclick="
var ta = this.form.ta0;
ta.readOnly = true;
ta.focus();
ta.select();
">
</form>
 
T

Tom

Mac OS X does not, in general, support drag-and-drop of text, nor does
Safari. They do support drag and drop of various objects such as URLs
and images.


It would help if you:

1. Supplied a minimal example of the code that produces the effect
2. Advised the versions of OS X or Safari tested
3. Told us how you tried to copy the text (e.g. using Edit->Copy, Ctrl
+v, right click, and so on)

and any other details you feel might be relevant.

The following "works" fine in Safari 4.0.3 (Mac OS X 10.6.1):

<form>
<textarea id="ta0">Here is some text</textarea>
<input type="button" value="Do stuff" onclick="
var ta = this.form.ta0;
ta.readOnly = true;
ta.focus();
ta.select();
">
</form>
since edit+>copy and dragging worked on my frined's slightly older
apple, it seems likely to me that the behavior i saw was due to a
safari setting. i'm working on getting the safari version number.

within my form i create the area like this...
<textarea name="PrivateText" cols="80" rows="4"></textarea>

this is how the textarea gets filled up...
form.PrivateText.value = "bla bla bla\n";
// (actually the value is more complex; it's correct by inspection)
form.PrivateText.focus();
form.PrivateText.select();
form.PrivateText.readOnly = true;

then it can't be copied or dragged on the newer apple but can be on
the older apple.
 
R

RobG

Check it again, Sam. It does drags. And drops too. In Safari. Yes.

Hey, it works - sort of!

I've only done that inside various programs before. It's a bit
problematic on my MB Pro, sometimes it drags, more often it changes
the selection. It seems you have to drag from one of the extremes of
the selection, dropping and returning to drag again almost always
changes the selection rather than dragging again.

I've always used Ctrl+C and Ctrl+V so never tried that before except
in a word processor, where I figured it was application level support.

 
J

Jorge

the version of safari that exhibited this strange behavior was 3.2.3
(5525.28.3)

Select and drag and drop from <input>s and <textarea>s with
readonly="true" is working for me in:

Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_4_11; es) AppleWebKit/
525.28.3 (KHTML, like Gecko) Version/3.2.3 Safari/525.28.3
and
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_1; en-us) AppleWebKit/
532.4+ (KHTML, like Gecko) Version/4.0.3 Safari/531.9

<textarea id="a" readOnly="true">texto de la textarea</textarea>
<input id="b" value="dirección_45" readOnly="true">
 
S

SAM

Le 11/7/09 1:50 AM, Jorge a écrit :
Select and drag and drop from <input>s and <textarea>s with
readonly="true" is working for me in:

Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_4_11; es) AppleWebKit/
525.28.3 (KHTML, like Gecko) Version/3.2.3 Safari/525.28.3
and
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_1; en-us) AppleWebKit/
532.4+ (KHTML, like Gecko) Version/4.0.3 Safari/531.9

<textarea id="a" readOnly="true">texto de la textarea</textarea>
<input id="b" value="dirección_45" readOnly="true">

Not tested with this exact example but
it works with my Safari 3.1.2 for Mac too
(system 10.4.11 iMac-Intel)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,527
Members
44,998
Latest member
MarissaEub

Latest Threads

Top