为您的网站创建桌面快捷方式的便携式方式?
我希望能够为我们的用户提供创建我们网站的桌面快捷方式的选项。 我做了一些研究,发现许多文章使用 ActiveX 访问 Windows 的 Shell API 来执行此活动,但我很好奇是否有一种方法可以内置到浏览器中来执行此操作缺少比 ActiveX 路由更可移植的功能。
I'd like to be able to give our users an option to create a desktop shortcut to our web site. I've done some research and found a number of articles using ActiveX to access the Shell API for Windows to perform this activity, but I'm curious as to whether there is a way to do it that is built into the browser that I might be missing that would be more portable than the ActiveX route.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Web 浏览器中没有内置方法可以执行此操作。 默认情况下,您的网站无法与浏览器以外的任何东西进行交互。 您可以采用 ActiveX 路线,但只有运行 Internet Explorer 的用户才支持该路线。 您可以尝试通过 Java 来完成此操作,但您可能会遇到安全和信任问题。 我建议您建议您的用户为您的页面添加书签,或者向他们提供有关如何自行创建快捷方式的分步说明。
There is no built in way of doing this in the web browser. You're website has not way of interacting with anything but the browser, by default. You can go the ActiveX route, but that would only be supported by users running Internet Explorer. You could try and do it through Java, but you will likely run into security and trust issues. I would suggest you recommend your users just bookmark your page, or give them step by step instructions on how to create the shortcut themselves.
如果您所说的“可移植”是指跨网络浏览器可移植,那么我认为您将找不到解决方案。 任何具有安全意识的浏览器都不会允许这样做。
如果您所说的“可移植”是指跨操作系统可移植,那么我认为您仍然找不到解决方案。 部分是因为上述原因,部分是因为并非所有操作系统和桌面环境都支持桌面图标/快捷方式。
If by portable you mean portable across web browsers then I think you won't find a solution. Any security conscious browser would not allow this.
If by portable you mean portable across operating systems then I think you still won't find a solution. Partly because of the above reason, partly because not all operating systems and desktop environments support desktop icons/shortcuts at all.
执行如下操作怎么样:
在您的网站上放置一个可用的文件 google.URL,其中包含类似内容
,然后要求您的用户将该文件保存在桌面上(右键单击 -> 另存为...)。
我快速尝试了一下,唯一的问题是默认情况下我的 WinXP 将其保存为文本文件,在文件名末尾添加 .txt。 因此这需要用户在保存时选择“所有文件”。 我想也许可以用 MIME 类型来解决这个问题?
How about doing something like the following:
Put a file google.URL available at your web site with contents like
And then asking your users to save the file on their desktop (Right click -> Save as...).
I tried this fast and only problem was that by default my WinXP was saving it as a text file, adding .txt to the end of the file name. So this would require users to select "All files" when saving. I think one could probably fix this with MIME types?