• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Clipboard setData Chrome limit

New Here ,
May 18, 2016 May 18, 2016

Copy link to clipboard

Copied

Hi

Many years ago I developed an application that allows the users to copy data in the form of html to allow the user to easily paste data in other applications such as Excel.

However, I have received complaints that this is not working in Chrome and after some testing I have discovered that there is a limitation to 1 million characters when copying from the application using Chrome. It is working fine in IE as well as for smaller strings in Chrome.

Code to replicate the error...

var str:String = "";

for(var i:uint = 0; i < 1000001; i++)

   str += "X";

trace(str.length)

try {

    Clipboard.generalClipboard.clear();

    var clipboardSuccess:Boolean = Clipboard.generalClipboard.setData(ClipboardFormats.HTML_FORMAT,str);     

    trace("setClipboard " + clipboardSuccess)

} catch (e:Error) {

    trace("Error setClipboard " + e);

}     

Obviously the code has to run in a button event. It is always working in IE and also in Chrome if the string is 1000000 or shorter.

Clipboard.generalClipboard.setData always returns true (success) and is never throwing any error.

System.setClipboard is the same.

Any workarounds? Is this a general Chrome limitation or something the Chrome Flash player?

TOPICS
ActionScript

Views

1.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 18, 2016 May 18, 2016

Copy link to clipboard

Copied

'chunk' the data.

the only problem is you may have to use some 'intelligent' chunking (because of the html formatting).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 18, 2016 May 18, 2016

Copy link to clipboard

Copied

Thanks kglad for the reply. There are many users of the app and I cannot ask them to cut and paste 3-4 times every time they want to use the data in another application. At the moment I tell users that Chrome is not compatible but it is a shame....

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 18, 2016 May 18, 2016

Copy link to clipboard

Copied

you would do the chunking with code so it's not seen by your users.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 18, 2016 May 18, 2016

Copy link to clipboard

Copied

Sounds interesting. Pls elaborate. Can I "add" to the clipboard? Or how do you mean?

Let's say I want to export a table that the user can paste in Excel. Let's say it has 3.5 million characters. How would I do that? I thought you ment to chunk it into four parts and ask the user to paste part 1, then press a button in the as3 app, paste part 2 and so on. That is not a pretty solution. But do you suggest I can chunk it and programmatically concatenate it in the clipboard from the as3 app?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 19, 2016 May 19, 2016

Copy link to clipboard

Copied

LATEST

i just realized, i have a clipboard manager and most people do not.  so most people cannot 'append' data to their clipboard and that means chunking can't be done seamlessly.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines