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

发布于 2024-12-06 03:04:43 字数 462 浏览 0 评论 0原文

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

好的,很好,但是有没有一种方法可以让我编写网页链接或表单按钮,以便它为我完成此操作?换句话说,单击按钮或链接就会显示“创建应用程序快捷方式”表单。我希望 Google Chrome 上有一种鲜为人知的方法来使用 HTML 或 Javascript 来触发显示该表单。

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

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

戏舞 2024-12-13 03:04:43

目前,在提供更好的答案之前,这是一种使用 Chrome 部署桌面应用程序的技术,采用手动方式,并且无需在 Chrome 商店中注册:

  1. 用户购买产品后,通过电子邮件向他们发送序列号用于注册其产品的号码以及用于安装此新产品的网址。
  2. Web URL 是 Web 应用程序的实际 URL。但是,默认情况下它不显示其正常内容。相反,网络应用程序处于“安装程序模式”。它通过查看可能尚未安装的 200 年持久加密注册 cookie 来实现此目的。 (请注意,如果他们删除 cookie,也不会造成任何损害 - 它只是要求他们再次重新注册。)
  3. Web 应用程序在安装程序模式下所做的第一件事是检测用户代理。如果发现这不是 Chrome,则会向他们提供安装 Chrome 的链接 并告诉他们再次按照已发送的说明电子邮件进行操作,但使用 Chrome 来执行此操作。 (您可能还需要提供一个表单,以便再次向他们重新发送说明和序列号。)
  4. 用户要么安装 Chrome 并再次返回此页面,要么已经是 Chrome 用户。然后,安装程序模式会显示一条消息,内容为:请按 Chrome 中的 ALT-F 键,或按工具栏中的扳手图标,然后选择“工具”>“安装程序”。创建应用程序快捷方式,选中两个复选框,单击“确定”,然后单击下面的“任务执行”按钮。
  5. 用户按照说明操作并创建桌面/应用程序快捷方式,然后单击“已执行的任务”。
  6. 然后,用户会看到一个注册表,他们需要在其中输入通过电子邮件发送的序列号。用户输入此内容并单击“注册”按钮。
  7. 服务器验证注册,然后存储一个持续 200 年的加密 cookie,基本上是说“这个人已经注册了”。这会阻止 Web 应用程序在安装程序模式下运行。
  8. 然而,安装程序模式仍然处于活动状态,并向他们显示最终提示:“您可以关闭浏览器并从您创建的桌面或应用程序快捷方式运行新应用程序的图标。该图标名为“{在此处插入名称}” '。”
  9. 他们关闭浏览器并双击该图标。应用程序加载,注册 cookie 被读取,并且 Web 应用程序不再以安装程序模式运行 - 它像平常一样显示应用程序内容。除了这不是 100% 真正的自动化安装之外,唯一的缺点是,由于主页不是本地文件(缓存),因此 Web 应用程序无法真正完全离线工作。当然,它可以使用 HTML5 离线存储,但双击桌面快捷方式将始终连接到您的 Web 应用程序站点。

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.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文