Not saved the file in chrome

12 views
Skip to first unread message

Мария Марковна

unread,
Jul 29, 2016, 12:45:59 PM7/29/16
to Google Chrome Developer Tools
HI!

The code to save html table in excel

table = document.getElementById('grid__staticWrapper')
var ctx = {worksheet: "excel" || 'Worksheet', table: table.innerHTML}
window.location.href = ('data:application/vnd.ms-excel,' +  encodeURIComponent(ctx.table));

Were conducted the following experiments
Everything works
ctx.table = ctx.table.substring(0,1000000)

Not working
ctx.table = ctx.table.substring(0,2000000)

The total length of more than 20 million characters

Сhrome Version 52.0.2743.82 m (64-bit)

What is the character limit?
This problem can be solved?

PhistucK

unread,
Jul 29, 2016, 12:53:29 PM7/29/16
to Google Chrome Developer Tools
Note - this is not the place for such questions. This group discusses the Developer Tools feature only. Please, post this sort of things elsewhere.

A quick Google search turned out some Stack Overflow questions that eventually lead to this issue - crbug.com/44820 - which says that the limit is two megabytes (2 million, you meant, not 20 million).

Your other option is probably to create a Blob, append the string to it and then convert it to a URL using URL.createObjectURL. That is probably the better way anyway, rather than a data URL. Once the file has started downloading, you can use URL.revokeObjectURL to let the garbage collector clear the memory it occupies.



PhistucK

--
You received this message because you are subscribed to the Google Groups "Google Chrome Developer Tools" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-chrome-develo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-chrome-developer-tools/229f17c1-eba7-46eb-8ca9-5eb4b3c224bb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages