JsPDF - Not allowed to navigate top frame to data URL

后端 未结 14 2198
Happy的楠姐
Happy的楠姐 2020-11-27 02:53

After updating Google Chrome, the report jsPDF in a new Window does not work any more.

The console shows the message:

Not allowed to navigate

相关标签:
14条回答
  • 2020-11-27 03:56

    Apparently Google Chrome has removed support for top-frame navigation, you can see more informations here: https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/GbVcuwg_QjM

    You may try to render the jsPDF to an iFrame

    0 讨论(0)
  • 2020-11-27 03:59

    Based on Joyston's answer, but without reparsing and therefore without additional need to escape something:

    x=window.open();
    iframe=x.document.createElement('iframe')
    iframe.width='100%'
    iframe.height='100%'
    iframe.frameBorder=0
    iframe.style="border: 0"
    iframe.src='data:text/html........' //data-uri content here
    x.document.body.appendChild(iframe);
    
    0 讨论(0)
提交回复
热议问题