Open window with data URL fails
-
Hello,
I have a crappy page that I created to learn some javascript. One part is to window.open() a new tab and put some random text there. This worked okay on Vivaldi until some version change quite a while ago. On FF this is still okay and I did not touch the code for a very long time.
This is the javascript code:
window.open('data:text/plain;charset=US-ASCII,random text', 'random name');
How can I make this work again with recent Vivaldi versions in a cross-browser compatible way, does anybody know?
Many thanks!
Roman
modedit changed title
-
Other than disabling the pop-up blocker?
-
Data urls in JS window.open are restricted for phishing reasons.
@ManzTheReader Can you please give us a complete test case to see what you are doing?
-
@Gwen-Dragon
thanks a lot for your help.
Trying to paste the sample code here was blocked as spam
Put it here: https://gist.github.com/RomanManz/6dca1708341ae6a14cdb3d7c33c2014f
-
@ManzTheReader Opening data urls from main window was removed (since Chromium 60!):
https://www.chromestatus.com/feature/5669602927312896
https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/GbVcuwg_QjM[1-25]
https://bugs.chromium.org/p/chromium/issues/detail?id=594215
-
@ManzTheReader Found a not-so-nice work around with iframes:
<html> <body> <script> function wopen(url){ var win = window.open(); win.document.write('<iframe src="' + url + '" frameborder="0" style="border:0; top:0px; left:0px; bottom:0px; right:0px; width:100%; height:100%;" allowfullscreen></iframe>'); } </script> <a href="#" onclick="wopen('data:text/plain;charset=US-ASCII,random text')">click to open new tab</a> </body> </html>
-
@Gwen-Dragon
Works perfectly with my codeThanks a lot!
-
@ManzTheReader Nice to hear my investigation could help.