Mahavirsinh Padhiyar
Mahavirsinh Padhiyar

Reputation: 1179

base 64 byte array not working in chrome

I am using ASP.NET MVC with jquery and SQL SERVER.

I have one page where I got base 64 from controller side to ajax success and pass it to the browser's new tab and it will show me pdf file:

window.open("data:application/pdf;base64, " + data.bytedata);

The interesting thing is in firefox it is working fine and in chrome as well it's working fine but since last 2 or 3 days in chrome it is not working just giving me some kind of bytedata that is not working in chrome and in firefox as well.

Might be problem is the bytedata coming from controller in chrome is invalid that's why it is not running in firefox as well and in chrome as well but same page same call bytedata coming from controller in firefox is running fine in chrome as well and in firefox too.

Don't know how to distinguish this problem.

Upvotes: 1

Views: 1452

Answers (1)

Mahavirsinh Padhiyar
Mahavirsinh Padhiyar

Reputation: 1179

Got it where my code stop working in chrome.

Actually Chrome has just recently released one new version on 2nd Aug:

Version 60.0.3112.90 (Official Build) (64-bit)

and it stopped working in above version.

My code runs perfectly fine in below version i.e. upto

Version 59.0.3071.86 (Official Build) (64-bit)

I have reported this issue to Chrome let's see how they resolve this.

UPDATED SOLUTION:

Use iframe and load base64 inside that:

window.open("<iframe src='data:application/pdf;base64, " + encodeURI(data.bytedata) + "'></iframe>")

Upvotes: 3

Related Questions