Question:
I have an API in laravel that generates a PDF with laravel snappy.
It works perfectly on chrome linux but on windows that have the newest version of chrome it doesn't work, chrome just opens a blank page.
I get base 64 like this:
window.open('data:application/pdf;charset=utf-8;base64,' + res.data.print_64);
Answer:
A partir da versão 60 do Chrome, as URLs top-frame foram bloqueadas, como segue:
Summary
We intend to block web pages from loading data: URLs in the top frame using tags, window.open, window.location and similar mechanisms.
Motivation
data: URLs are generally a source of confusion for users. Because of their unfamiliarity and ability to encode arbitrary untrusted content in a URL, they are widely being used in spoofing and phishing attacks. Another problem is that they can be passed along without a backing page that runs JavaScript (e.g. a data URL can be sent via email). For that reason, we intend to block top-frame navigations to data URLs.
Fonte: https://productforums.google.com/forum/#!topic/chrome/k-9y57tme2E
Alternativa:
Renderize o seu PDF em um <object>
var base64 = 'seuBase64';
var novaJanela = window.open("", "PDF", 'dependent=yes,locationbar=no,scrollbars=no,menubar=no,resizable,screenX=50,screenY=50,width=850,height=800');
novaJanela.document.write('<html><body><object width=100% height=100% type="application/pdf" data="data:application/pdf;base64,' + base64 + '"><embed type="application/pdf" src="data:application/pdf;base64,' + base64 + '"></embed></object></body></html>');
novaJanela.window.focus();