0

My issue is simple. I want to use javascript to open a dynamically generated dataURI inside of a new tab inside a single browser window. The following code does the trick in Firefox ('Hello World' is a toy example. A function returning a string of the generated dataURL will appear in it's place.)

 var win = window.open(data:text/plain;charset=utf-8,Hello%20World, '_blank');
 win.focus();

In Chrome, this same code will open a totally blank page with the URL space marked about:blank instead of the expected URI (as is the case with Firefox).

Either Chrome has this disabled as a security feature of some sort, or Firefox is supporting some aspect of the above code as an experimental feature. Does anyone have a sense of what is going on here? And if so, is there a workaround?

I should add that the Chrome console is not showing any error messages or alerts of any kind.

Shadow43375
  • 514
  • 7
  • 20
  • Pretty sure it's a Chrome security thing; I would expect Firefox to start behaving that way fairly soon too. Edge also does that I think. – Pointy May 29 '18 at 20:43
  • And yet no console notifications to that effect! In Firefox they explicitly articulated similar issues in the console. https://blog.mozilla.org/security/2017/11/27/blocking-top-level-navigations-data-urls-firefox-59/ – Shadow43375 May 29 '18 at 20:45
  • 1
    https://www.fxsitecompat.com/en-CA/docs/2017/data-url-navigations-on-top-level-window-will-now-be-blocked/ also – Pointy May 29 '18 at 20:46
  • Possible duplicate of [JsPDF - Not allowed to navigate top frame to data URL](https://stackoverflow.com/questions/45493234/jspdf-not-allowed-to-navigate-top-frame-to-data-url) – Josh Lee May 29 '18 at 21:16

0 Answers0