Page 1 of 1

Copy/Paste using HTML5 with Mac browsers not working

Posted: Tue Aug 04, 2015 4:34 pm
by cesare
Using TSPlus 08.30.8.1 with HTML5, we have noticed that copy and paste using Mac Browsers is not working.
Tried with:
- Chrome 44.0.2403.125
- Firefox 39.0

The same using PC Windows, same browsers version is working.

We are experiencing the same problem also using Mac Browsers copy/paste with the demo on line at "http://www.terminalserviceplus.com/demo.php" (simply using "Notepad.exe"), so issue seems not related to our pubblished application.

Any suggestions, if available, will be appreciated.

Re: Copy/Paste using HTML5 with Mac browsers not working

Posted: Wed Aug 05, 2015 8:33 pm
by juwagn
Hello,

>>we are experiencing the same problem also using Mac Browsers copy/paste with the demo on line
Technically browsers do not support ClipBoard data exchange with system via JavaScript...
To work around this limitation there is small solution...
On PCs
1. When user presses Ctrl+C than with 99% likeliness user wants to copy data from session clipboard into his local clipboard.
2. I create blocking synchronous XMLHttpRequest where entire Javacript blocks until it gets data back from server..
3. In this request I ask server, give me clipboard data if any available.
4. When data is available I create hidden text input field
5. Insert this data that I got from server into this input field
6. Run special JavaScript that marks entire text in this hidden field.
7. Now into the game comes the browser, usually when you press Ctrl+C on some text field where text is marked, the native handler of browser copies this text into local clipboard environment, so exactly this it does here too.
This approach evidently would not work with the mouse, because there you can not predict, when the user wants to copy/insert data..
When inserting text with Ctrl+V it is almost similar, but lesser so difficult and does not request to create blocking XMLHttpRequest request..

You may ask, why I am explaining it to you so much in detail..
Answer is easy, as you see from step 7, the native handler of browser is requested to work properly, but you may already have noticed, Ctrl+C/V do not work natively to copy/paste text on Macs.
There you have to use CMD+C/V, i do not remember exactly, I believe, i have attached such handler on left CMD button, that works like Ctrl button.

However when Mac Chrome and Mac FF are going well with this approach CMD+C/V, by Mac Safari unfortunally (but may be they fixed that already) this native handling seems to run in separate thread and is not blocked by XMLHttpRequest, so that it does not wait until the clipboard data comes from session. (however when pressing twice that may workaround it, but not always)

Hope, it was helpful.

Re: Copy/Paste using HTML5 with Mac browsers not working

Posted: Thu Aug 06, 2015 8:23 am
by cesare
Thanks for the suggestion, but unfortunately it is NOT working on Mac browser (tried latest Chrome, Firefox, Safari): tried both CTRL C/V, CMD C/V (and also the "Edit" submenus Copy/Paste).

The same using Windows browser (tried latest Chrome, Firefox, Safari) works perfectly.

I did testing simply with "Notepad.exe" published from demo site terminalserviceplus.com/demo.php

Re: Copy/Paste using HTML5 with Mac browsers not working

Posted: Thu Aug 06, 2015 11:12 am
by juwagn
Hello,

yes, I confirm it, it has stopped to work. Also only option on Mac is to use clipboard menu to copy to local environment, requests few more steps, but at least it is actually better than nothing.

PS: update> it was also right CMD, also when ever you come to point to copy clipboard data to local environment, please use
right cmd+c/v.
Left cmd I had to prevent completely before being able to press it due some unsolvable/unpreventable actions...

PPS: on FF mac you can use right cmd+a to mark text, but on Chrome Mac to mark text so is not possible, also this action is working only with Ctrl+A, because there when right cmd is pressed, the A button is not fired as event, so can not send it to session, but C/V are ok..
with left CMD button also the C/A buttons events were not fired too, that is also everything browser sugar, therefore to not jeopardize it decided to use right cmd button for all browsers.. so notice, wished to copy clipboard to local Mac environment, use right cmd+c, wished to fetch data from local environment and insert into session,than right cmd+v

Re: Copy/Paste using HTML5 with Mac browsers not working

Posted: Thu Aug 06, 2015 2:11 pm
by cesare
Hello

thanks for the suggestions, I have tried on Mac browser to make Right CMD copy and paste and I confirm "sometime" (not always) it worked: as you pointed, it is for sure "better than nothing".

Hope there will be some improvements in future version for HTML5 for Mac browser also. Using Windows browser HTML5 no problem at all.

Major problem on Mac Browser is that cannot insert char "@" using Mac Browser (all mac browser with italian keyboard and language), unfortunately I am afraid this can become a "showstopper" issue for us. (more details at tsplus.net/forum/viewtopic.php?f=8&t=3559)

Thanks again for your help !

Re: Copy/Paste using HTML5 with Mac browsers not working

Posted: Thu Aug 06, 2015 5:47 pm
by juwagn
>>"sometime" (not always) it worked
As mentioned, on Mac Safari this work so as you describe, sometimes, because the native browsers handler seems to run in separate thread/internal_process and is not waiting for input data, there I have to press it twice in short period of time. I can not change this behaviour, I am not Apple chief :)
But on Mac Chrome and Mac FF - right_cmd+c/v work by me properly, I checked that.. their native handler waits for completion of JavaScript..
Well, it is Mac world!!! You have to suffer something and use Windows approach when using keyboard with browser.

PS: there is the way to use html5 clipboard api with synthetic bug, but it is very unreliable solution to count on it.. i can include it, but unfortunally can not ensure that it will work or will work forever..

Re: Copy/Paste using HTML5 with Mac browsers not working

Posted: Fri Aug 07, 2015 8:32 am
by cesare
Hello

I did additional testing of copy/paste (using latest Chrome version on Mac italian browser).

I confirm that using "Notepad.exe" on http://www.terminalserviceplus.com/demo.php: copy and paste is working but only using using RIGHT_CMD C/V.

But it works ONLY first time, so if I have to paste twice the same, second time it is not working (also waiting seconds).

But worse (for us) using "Notepad.exe" in our TS Plus installation (using latest Chrome version on Mac italian browser) it NEVER works, don't know why.

If you have some suggestions it will be appreciated.

Thanks !

Re: Copy/Paste using HTML5 with Mac browsers not working

Posted: Tue Jun 20, 2017 10:13 am
by kennethfranz
I think this is not related to the operation of your browser. The problem can be at the system level. I advise you to restore the system. This is not the easiest way, try with the reinstallation of the browser, try something else, I recently tried this one https://yumdownload.com/safari. I've never used it, but it's pretty nice software for the user.

Re: Copy/Paste using HTML5 with Mac browsers not working

Posted: Tue Jun 20, 2017 10:27 am
by juwagn
Safari browser stopped being developed and supported for a very long time on Windows system, so please don't propose such downloads!