sailfishos / sailfish-browser

Sailfish Browser
https://github.com/sailfishos/sailfish-browser/wiki/Sailfish-Browser-wiki
Mozilla Public License 2.0
307 stars 87 forks source link

javascript window.open() does not support data uris #517

Open juiceme opened 8 years ago

juiceme commented 8 years ago

Please see the issue in https://together.jolla.com/question/146722/handling-of-javascript-windowopen-in-the-browser/

I have a web application that needs to show/push content to the user by opening a new tab / new window. This works in desktop browsers, at least Firefox, Chrome and Safari but seems not to open anything in the Sailfish Browser.

The client-side code is like this;

// Server pushes a PDF to client via websocket, PDF gets rendered in a new tab
if(receivable.type == "pdfUpload") {
    var pdfData = atob(JSON.parse(decrypt(receivable.content, sessionPassword)));
    window.open("data:application/pdf," + escape(pdfData));
}

and this

// Server pushes zipped invoices to client via websocket, prompting use to save/open
if(receivable.type == "zipUpload") {
    var zipData = atob(JSON.parse(decrypt(receivable.content, sessionPassword)));
    window.open("data:application/zip," + escape(zipData));
}

and this

// Server pushes helptext html to client via wabsocket, it gets rendered in a new window
 if(receivable.type == "helpText") {
    var helpText = atob(JSON.parse(decrypt(receivable.content, sessionPassword)));
    var wnd = window.document.open("about:blank", "", "scrollbars=yes");
    wnd.document.write(decodeURIComponent(escape(helpText)));
    wnd.document.close();
}

It seems to me that Sailfish browser does not support content pushing to new tab/window at all.

When I start the browser from command line and try to access my application here are the results on console:

  1. the first 2 cases (PDF upload and Zipfile upload) do not cause anything to happen, and there is no error message.
  2. the last case produces an error "JavaScript error: http://site.domain/pantterilasku#, line 169: wnd is null"

The line 169 refers to the line "wnd.document.write(decodeURIComponent(escape(helpText)));" in the above snippet.

juiceme commented 6 years ago

Hmm it indeed has been a while... are there any developments regarding data uri support?