How to open a Chrome Packaged App with a parameter on Windows?

。_饼干妹妹 提交于 2019-12-07 19:47:24

Thanks Ben Wells, it's working now. The code (if someone has the same problem one day):

In manifest.json:

"file_handlers": {
    "text": {
        "extensions": [
            "md"
        ],
        "title": "YourApp"
    }
},

And what to do on the command line (remove (x86) if you're on a 32-bit Windows):

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --app-id=YourAppId "C:\Path\To\document.md"

If you want to see if your app has detect a parameter, add the code above (the block who begins with chrome.app.runtime.onLaunched) to your background javascript.

Command line parameters to packaged apps do not seem to be implemented yet.

The open issue 165573 "Allow launch arguments to be passed to platform apps" states "We need to figure out ... if / how to pass these via the command line".

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!