Jujuyeh / webapp-creator

Ubuntu Touch Webapp Creator
9 stars 4 forks source link

accept from url, and with argument #41

Open mateosalta opened 6 years ago

mateosalta commented 6 years ago

if a app wanted to link to webapp creator - https://github.com/ubports/morph-browser/issues/18 we would need to accept a url argument

niutech commented 5 years ago

You can do it by adding webapp-creator.url-dispatcher file with the contents: [{"protocol": "webapp-creator"}] and adding a hook to manifest.json file: "hooks": { "webapp-creator": {"urls": "webapp-creator.url-dispatcher"} }. Then you can invoke Webapp Creator by URL: webapp-creator://params and get the params by parsing the URL in QML: var params = Array.prototype.slice.call(Qt.application.arguments).filter(function (a) { return a.match(/^webapp-creator:\/\//); })[0].substring(17); The image in QML could be serialized as data URI: Image { source: "data:image/png;base64," + imageDataFromURL }.