Re: copy annoyance fix

From: Date: Sun, 15 Sep 2002 19:15:33 +0000
Subject: Re: copy annoyance fix
References: 1 2 3 4 5 6  Groups: php.doc.chm 
Request: Send a blank email to php-doc-chm+get-514@lists.php.net to get a copy of this message
"Gabor Hojtsy" <gabor@hojtsy.hu> wrote in message news:045401c25c3c$403d0850$4bc14d3e@mia... > > this is the last bloody time I look at this copy feature! > > > > any way, I think I found a solution that will work with ie4+ and will not > > cause ie5.0-5.1 to occasionally crash on select operating systems. oah > ya... > > and the bug that we were experiencing earlier. > > > > take a look, the only thing I changed was copyExample() > > > > no I didn't change the selection copy, I cant get the right click menu to > > work for the life of me. any way, it shouldn't be hard for someone else to > > implement. > > > > the link is http://knightsweb.net/_script.zip > > OK, so just talk about this a bit before applying any fix (I won't > release a new sample just because of this issue). > > You used this code: > > BodyRange = document.body.createTextRange(); > BodyRange.moveToElementText( document.body.all['example_' + number]); > BodyRange.execCommand( "Copy" ); > > if (document.selection && window.clipboardData) { > window.clipboardData.setData("Text", document.all['example_' + > number].innerText); > } else { > alert("Example copy won't work with this browser"); > } > > This tries to find out if there is any incompatibility. > clipboardData is actually supported since IE5, so older > browsers will only print out the alert. Otherwise from > the code there should be no problem, as innertext for > <code>s is available since 4.0. It may be buggy though... > > Your code simply tries to use textranges, with wich the > moveToElementText is only available since 5.0, so the > lowest IE version needed is still IE5. Drat. I thought it was ie4 combatable. oah well, it still solves the problem of ie 5 sometimes not working. if you could think if a way to position the start and end pointers of the text range without ToElementText then it should be ie4 committable. (in theory of course) on top of the problem that we were experiencing earlier, with the setData not copying, setData sometimes causes ie to crash. you can read about it here. http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q250573& > Have you tested > this, and found that it works for you? yes, I have tested it on my ie5.0 and ie6.0 both on win98se. >Then so maybe > if we spice it up with some compatibility tests, it > would work... that sounds like a good idea. > > Goba > >

« previous php.doc.chm (#514) next »