我可以通过网页以编程方式创建Chrome应用程序快捷方式吗? [英] Can I Create Chrome Application Shortcuts Programmatically from a Web Page?

查看:177
本文介绍了我可以通过网页以编程方式创建Chrome应用程序快捷方式吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我曾考虑过使用Chrome和HTML5本地存储来创建一个有用的应用并将其出售。然而,我想我会遇到的问题是将其安装在计算机上的传送机制。假设该应用程序是wikipedia.com(尽管不是)。手动可以使用Chrome浏览器,然后选择扳手图标,工具,创建应用程序快捷方式,并为应用程序制作桌面和应用程序菜单图标。



好的,罚款,但有没有一种方法可以编写一个网页链接或表单按钮,以便它为我做到这一点?换句话说,只需点击一个按钮或链接即可显示创建应用程序快捷方式窗体。我希望Google Chrome上有一种鲜为人知的方式,可以使用HTML或Javascript来触发显示该表单。



至于那些没有Chrome的用户,我可以检测到,并给他们一个按钮,他们点击发送电子邮件。在电子邮件中,它会向他们提供安装Chrome和其他链接的说明,以便他们可以在Chrome中访问此页面,以获取显示创建应用程序快捷方式表单的按钮。




  1. 在用户购买产品后,通过电子邮件向他们发送注册产品的序列号和网址以安装此新产品。

  2. 网页网址是网页应用程式的实际网址。但是,默认情况下,它不显示其正常内容。相反,Web应用程序处于安装程序模式。它通过查看可能尚未安装的200年持久,加密的注册cookie来实现此目的。 (请注意,如果他们删除了cookies,则不会造成任何损害 - 它只是要求他们重新注册。)

  3. Web应用程序在安装程序模式下执行的第一件事是检测用户代理。如果发现这不是Chrome浏览器,则会向他们提供安装Chrome浏览器的链接并告诉他们再次按照指示电子邮件发送他们已发送的邮件,但使用Chrome来执行此操作。 (您可能还想提供表单,以重新发送说明和序列号。)

  4. 用户安装Chrome并返回到此页面,或者已经是Chrome用户。安装程序模式然后显示一条消息,请按Chrome中的ALT-F键,或者按工具栏中的扳手图标,然后选择工具>创建应用程序快捷方式,选中两个复选框,单击确定,然后单击任务执行按钮。

  5. 用户按照说明创建桌面/应用程序快捷方式,然后单击任务执行。

  6. 用户然后看到一个登记表,他们要输入他们通过电子邮件发送的序列号。用户输入并点击注册按钮。

  7. 服务器验证注册,然后存储一个持久的,200年加密的cookie,基本上说:这个人是注册的。这使得Web应用程序无法在安装程序模式下运行。

  8. 然而,安装程序模式仍处于活动状态,并向他们显示最终提示:您可以关闭浏览器并运行新图标命名为'{insert name here}'。

  9. 他们关闭浏览器并双击图标。应用程序加载后,将读取注册cookie,并且Web应用程序不再以安装程序模式运行 - 它会像通常那样显示应用程序内容。除了这不是100%真正的自动化安装,唯一的缺点是,由于主页面不是本地文件(缓存),因此Web应用程序无法完全脱机工作。当然,它可以使用HTML5离线存储,但双击桌面快捷方式将始终连接到您的Web应用程序站点。


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 computer. Let's say the app was wikipedia.com (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 compose 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.

解决方案

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 completely. Sure, it can use HTML5 offline storage, but doubleclicking the desktop shortcut will always connect to your web app site.

这篇关于我可以通过网页以编程方式创建Chrome应用程序快捷方式吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆