HighDots Forums  

safari supressing textarea copy/drag

Javascript JavaScript language (comp.lang.javascript)


Discuss safari supressing textarea copy/drag in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Tom
 
Posts: n/a

Default safari supressing textarea copy/drag - 11-06-2009 , 04:59 AM






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

Reply With Quote
  #2  
Old   
RobG
 
Posts: n/a

Default Re: safari supressing textarea copy/drag - 11-06-2009 , 06:24 AM






On Nov 6, 7:59*pm, Tom <supp... (AT) privatejpeg (DOT) com> wrote:
Quote:
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.

Quote:
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>


--
Rob

Reply With Quote
  #3  
Old   
Jorge
 
Posts: n/a

Default Re: safari supressing textarea copy/drag - 11-06-2009 , 01:59 PM



On Nov 6, 12:24*pm, RobG <rg... (AT) iinet (DOT) net.au> wrote:
Quote:
Mac OS X does not, in general, support drag-and-drop of text, nor does
Safari. (...)
Check it again, Sam. It does drags. And drops too. In Safari. Yes.
--
Jorge.

Reply With Quote
  #4  
Old   
Tom
 
Posts: n/a

Default Re: safari supressing textarea copy/drag - 11-06-2009 , 03:13 PM



On Fri, 6 Nov 2009 03:24:22 -0800 (PST), RobG <rgqld (AT) iinet (DOT) net.au>
wrote:

Quote:
On Nov 6, 7:59*pm, Tom <supp... (AT) privatejpeg (DOT) com> wrote:
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
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.

Reply With Quote
  #5  
Old   
RobG
 
Posts: n/a

Default Re: safari supressing textarea copy/drag - 11-06-2009 , 06:14 PM



On Nov 7, 4:59*am, Jorge <jo... (AT) jorgechamorro (DOT) com> wrote:
Quote:
On Nov 6, 12:24*pm, RobG <rg... (AT) iinet (DOT) net.au> wrote:



Mac OS X does not, in general, support drag-and-drop of text, nor does
Safari. (...)

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.


Quote:
--
Jorge.

Reply With Quote
  #6  
Old   
Tom
 
Posts: n/a

Default Re: safari supressing textarea copy/drag - 11-06-2009 , 06:39 PM



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

On Fri, 6 Nov 2009 03:24:22 -0800 (PST), RobG <rgqld (AT) iinet (DOT) net.au>
wrote:

Quote:
On Nov 6, 7:59*pm, Tom <supp... (AT) privatejpeg (DOT) com> wrote:
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

Reply With Quote
  #7  
Old   
Jorge
 
Posts: n/a

Default Re: safari supressing textarea copy/drag - 11-06-2009 , 07:50 PM



On Nov 7, 12:39*am, Tom <supp... (AT) privatejpeg (DOT) com> wrote:
Quote:
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">
--
Jorge.

Reply With Quote
  #8  
Old   
Jorge
 
Posts: n/a

Default Re: safari supressing textarea copy/drag - 11-06-2009 , 07:52 PM



On Nov 7, 1:50*am, Jorge <jo... (AT) jorgechamorro (DOT) com> wrote:
Quote:
textarea id="a" readOnly="true">texto de la textarea</textarea
input id="b" value="dirección_45" readOnly="true"
s/readOnly/readonly/
--
Jorge.

Reply With Quote
  #9  
Old   
SAM
 
Posts: n/a

Default Re: safari supressing textarea copy/drag - 11-06-2009 , 08:22 PM



Le 11/7/09 1:50 AM, Jorge a écrit :
Quote:
On Nov 7, 12:39 am, Tom <supp... (AT) privatejpeg (DOT) com> wrote:
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"
Not tested with this exact example but
it works with my Safari 3.1.2 for Mac too
(system 10.4.11 iMac-Intel)

--
sm

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.