最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Can I Create Chrome Application Shortcuts Programmatically from a Web Page? - Stack Overflow

programmeradmin1浏览0评论

I've thought about using Chrome and HTML5 local storage to create a useful app and sell it. The problem I think I would have, however, is the delivery mechanism to get this installed on one's puter. Let's say the app was wikipedia (although it isn't). Manually one can go there with Chrome, then choose the wrench icon, Tools, Create Application Shortcuts, and make a desktop and application menu icon for the app.

Okay, fine, but is there a way I can pose a web page link or form button such that it does this for me? In other words, one clicks a button or link and it shows the Create Application Shortcuts form. I am hoping that there's this little-known way on Google Chrome to use either HTML or Javascript to trigger showing that form.

As for those who don't have Chrome, I can detect that and give them a button they click that emails them. In the email, it will give them instructions for installing Chrome and then another link so that they can visit this page in Chrome in order to get the button that shows the Create Application Shortcuts form.

I've thought about using Chrome and HTML5 local storage to create a useful app and sell it. The problem I think I would have, however, is the delivery mechanism to get this installed on one's puter. Let's say the app was wikipedia. (although it isn't). Manually one can go there with Chrome, then choose the wrench icon, Tools, Create Application Shortcuts, and make a desktop and application menu icon for the app.

Okay, fine, but is there a way I can pose a web page link or form button such that it does this for me? In other words, one clicks a button or link and it shows the Create Application Shortcuts form. I am hoping that there's this little-known way on Google Chrome to use either HTML or Javascript to trigger showing that form.

As for those who don't have Chrome, I can detect that and give them a button they click that emails them. In the email, it will give them instructions for installing Chrome and then another link so that they can visit this page in Chrome in order to get the button that shows the Create Application Shortcuts form.

Share Improve this question asked Sep 23, 2011 at 17:30 VolomikeVolomike 24.9k22 gold badges126 silver badges217 bronze badges 4
  • BTW, Item 15 from here google./chrome/intl/en/webmasters-faq.html#tools has some tips on how to customize the Chrome app a little. However, the Gears Desktop API no longer works -- it's deprecated. (And I have Linux, which it never worked on.) – Volomike Commented Sep 23, 2011 at 18:00
  • BTW, if you visit this page google./support/blogger/bin/answer.py?hl=en&answer=41973 you will see an Install button. It is a simple form that lets you deploy an extension, but it still doesn't make a Chrome shortcut for it. It's a step in a good direction, however. – Volomike Commented Sep 23, 2011 at 18:16
  • Using a SendKeys approach (if one has Google Chrome installed), the keystroke path is ALT-F, then L, then S. That shows the dialog to make the shortcut. I wish I could do this via Javascript. – Volomike Commented Sep 23, 2011 at 18:28
  • Here is the start of something I found. It's called "Chromium Packaged Apps": code.google./chrome/extensions/apps.html – Volomike Commented Sep 23, 2011 at 18:34
Add a ment  | 

1 Answer 1

Reset to default 3

For now, until a better answer can be provided, this is sort of the technique for deploying a desktop app with Chrome, the manual way, and without having to register in the Chrome Store:

  1. After the user purchases a product, email them the serial number for registering their product and a web URL to install this new product.
  2. The web URL is the actual URL of the web app. However, it doesn't display its normal content by default. Instead, the web app is in "installer mode". It does this by looking at a 200 year persistent, encrypted, registration cookie that may not already be installed. (Note if they delete cookies, there's no harm done -- it just asks them to re-register again.)
  3. The first thing the web app does in Installer Mode is detect user agent. If it finds this is not Chrome, it gives them a link to install Chrome and tells them to follow the instruction email again that they have already been sent, but using Chrome to do this. (You might also want to provide a form to resend them the instructions and serial number again.)
  4. The user either installs Chrome and returns back to this page again, or is already a Chrome user. The Installer Mode then shows a message that reads, please press the ALT-F key in Chrome, or press the Wrench icon in your toolbar, and choose Tools > Create Application Shortcuts, check the two checkboxes, click OK, and then click the "Task Performed" button below.
  5. The user follows the instructions and creates their desktop/application shortcut and then clicks "Task Performed".
  6. The user then sees a registration form where they are to type in their serial number they were emailed. The user enters this in and clicks the Register button.
  7. The server validates the registration and then stores a persistent, 200 year encrypted cookie that basically says, "This guy is registered." This keeps the web app from running in Installer Mode.
  8. The Installer Mode is still active, however, and shows them the final prompt: "You may close your browser and run the icon for the new app from your desktop or application shortcut that you created. The icon is named '{insert name here}'."
  9. They close their browser and doubleclick the icon. The application loads, the registration cookie is read, and the web app no longer runs in Installer Mode -- it shows the application content like it normally would. Besides the fact that this is not a 100% truly automated install, the only drawback is that, since the main page is not a local file (cached), the web app can't really work offline pletely. Sure, it can use HTML5 offline storage, but doubleclicking the desktop shortcut will always connect to your web app site.
发布评论

评论列表(0)

  1. 暂无评论