我可以通过网页以编程方式创建Chrome应用程序快捷方式吗?

时间:2022-06-05 06:37:56

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.

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

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.

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

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.

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

1 个解决方案

#1


2  

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:

目前,在提供更好的答案之前,这是一种使用Chrome以手动方式部署桌面应用程序的技术,而无需在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. 用户购买产品后,通过电子邮件向他们发送用于注册其产品的序列号和用于安装此新产品的Web URL。
  3. 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.)
  4. Web URL是Web应用程序的实际URL。但是,默认情况下它不会显示其正常内容。相反,Web应用程序处于“安装程序模式”。它通过查看可能尚未安装的200年持久加密注册cookie来实现此目的。 (注意,如果他们删除了cookie,就没有造成任何伤害 - 它只是要求他们重新注册。)
  5. 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.)
  6. Web应用程序在安装程序模式下执行的第一件事是检测用户代理。如果它发现这不是Chrome,它会为他们提供一个安装Chrome的链接,并告诉他们再次按照指示电子邮件发送已经发送的内容,但使用Chrome执行此操作。 (您可能还需要提供一个表单,以便再次向他们重新发送说明和序列号。)
  7. 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.
  8. 用户要么安装Chrome并再次返回此页面,要么已经是Chrome用户。然后安装程序模式显示一条消息,请按Chrome中的ALT-F键,或按工具栏中的扳手图标,选择工具>创建应用程序快捷方式,选中两个复选框,单击确定,然后单击“任务执行“下面的按钮。
  9. The user follows the instructions and creates their desktop/application shortcut and then clicks "Task Performed".
  10. 用户按照说明操作并创建桌面/应用程序快捷方式,然后单击“执行任务”。
  11. 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.
  12. 然后,用户会看到一个注册表单,在那里他们要输入他们通过电子邮件发送的序列号。用户输入此内容并单击“注册”按钮。
  13. 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.
  14. 服务器验证注册,然后存储一个持久的,200年加密的cookie,基本上说“这个人已注册”。这使Web应用程序无法在安装程序模式下运行。
  15. 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}'."
  16. 但是,安装程序模式仍处于活动状态,并向他们显示最终提示:“您可以关闭浏览器并从您创建的桌面或应用程序快捷方式运行新应用程序的图标。该图标名为'{insert name here} ”“。
  17. 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.
  18. 他们关闭浏览器并双击图标。应用程序加载,读取注册cookie,Web应用程序不再以安装程序模式运行 - 它通常会显示应用程序内容。除了这不是100%真正自动化的安装之外,唯一的缺点是,由于主页面不是本地文件(缓存),因此Web应用程序无法完全脱机工作。当然,它可以使用HTML5离线存储,但双击桌面快捷方式将始终连接到您的Web应用程序站点。

#1


2  

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:

目前,在提供更好的答案之前,这是一种使用Chrome以手动方式部署桌面应用程序的技术,而无需在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. 用户购买产品后,通过电子邮件向他们发送用于注册其产品的序列号和用于安装此新产品的Web URL。
  3. 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.)
  4. Web URL是Web应用程序的实际URL。但是,默认情况下它不会显示其正常内容。相反,Web应用程序处于“安装程序模式”。它通过查看可能尚未安装的200年持久加密注册cookie来实现此目的。 (注意,如果他们删除了cookie,就没有造成任何伤害 - 它只是要求他们重新注册。)
  5. 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.)
  6. Web应用程序在安装程序模式下执行的第一件事是检测用户代理。如果它发现这不是Chrome,它会为他们提供一个安装Chrome的链接,并告诉他们再次按照指示电子邮件发送已经发送的内容,但使用Chrome执行此操作。 (您可能还需要提供一个表单,以便再次向他们重新发送说明和序列号。)
  7. 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.
  8. 用户要么安装Chrome并再次返回此页面,要么已经是Chrome用户。然后安装程序模式显示一条消息,请按Chrome中的ALT-F键,或按工具栏中的扳手图标,选择工具>创建应用程序快捷方式,选中两个复选框,单击确定,然后单击“任务执行“下面的按钮。
  9. The user follows the instructions and creates their desktop/application shortcut and then clicks "Task Performed".
  10. 用户按照说明操作并创建桌面/应用程序快捷方式,然后单击“执行任务”。
  11. 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.
  12. 然后,用户会看到一个注册表单,在那里他们要输入他们通过电子邮件发送的序列号。用户输入此内容并单击“注册”按钮。
  13. 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.
  14. 服务器验证注册,然后存储一个持久的,200年加密的cookie,基本上说“这个人已注册”。这使Web应用程序无法在安装程序模式下运行。
  15. 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}'."
  16. 但是,安装程序模式仍处于活动状态,并向他们显示最终提示:“您可以关闭浏览器并从您创建的桌面或应用程序快捷方式运行新应用程序的图标。该图标名为'{insert name here} ”“。
  17. 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.
  18. 他们关闭浏览器并双击图标。应用程序加载,读取注册cookie,Web应用程序不再以安装程序模式运行 - 它通常会显示应用程序内容。除了这不是100%真正自动化的安装之外,唯一的缺点是,由于主页面不是本地文件(缓存),因此Web应用程序无法完全脱机工作。当然,它可以使用HTML5离线存储,但双击桌面快捷方式将始终连接到您的Web应用程序站点。