Window is not allowed to navigate Top-frame navigations to data URLs

Viewed 10512

Earlier following code would open a pdf file in a new window.

var pdfDocument = "data:application/pdf;base64," + data;
window.open(pdfDocument);

After updating chrome, it seems to stop working. Appranely, chrome removed Top-frame navigations to data URLs.

How can I solve my issue now? I need to open this pdf in a new window. Any help will be appreciated.

UPDATE

Solved it using iFrame. Thanks to Pedro for giving me the idea.

<iframe id="ManualFrame"
        frameborder="0"
        style="border:0"
        allowfullscreen>
</iframe>

<script>
    $(function () {
        setManualFrame();
    });

    function setManualFrame() {
        $("#ManualFrame").attr("height", screen.height);
        $("#ManualFrame").attr("width", screen.width);
        $("#ManualFrame").attr("src", "data:application/pdf;base64," + '@ViewBag.pdf_base64_data');
    }
</script>
1 Answers
Related