Html 如何在 iOS 主屏幕上为图标设置自定义 URL

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15883736/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 07:21:36  来源:igfitidea点击:

How to have a custom URL for an icon on the iOS home screen

htmliphonemobile-safarifavorites

提问by kaeruranawa

Is it possible to make a custom URL for an icon on the iOS home screen? Or at least have a way for the user to edit the URL themselves?

是否可以为 iOS 主屏幕上的图标创建自定义 URL?或者至少有一种方法让用户自己编辑 URL?

UPDATE: To be more specific, here's what the client said:

更新:更具体地说,这是客户所说的:

"Because of our use of authentication, the URL of the landing page that [website] takes you to changes to a long URL with a session ID. Right now, when I use the Add to Home Screen function, it associates the icon with the long URL which, because of the session ID, won't work after a couple of days. Is there any way to change the URL to [website] (our stable and persistent URL) after or before the Add to home screen function is invoked"

“由于我们使用身份验证,[网站] 带您进入的登录页面的 URL 更改为带有会话 ID 的长 URL。现在,当我使用添加到主屏幕功能时,它会将图标与很长的 URL,由于会话 ID,几天后将无法工作。有没有办法在调用添加到主屏幕功能之后或之前将 URL 更改为 [website](我们的稳定且持久的 URL) ”

Also, the website isn't a web app, so I'm not sure if web app things would apply here.....?

此外,该网站不是一个网络应用程序,所以我不确定网络应用程序的东西是否适用于这里......?

采纳答案by skolima

This answer is no longer valid, but can't be deleted as it's the accepted answer.

这个答案不再有效,但不能删除,因为它是公认的答案。

No, it's not possible to do this because of security constraints. You need to handle those expired session IDs on the web application side - it's usually done with a redirect to the authentication page, most web frameworks should do this out of the box for you.

不,由于安全限制,这是不可能的。您需要在 Web 应用程序端处理那些过期的会话 ID - 通常是通过重定向到身份验证页面来完成的,大多数 Web 框架应该为您开箱即用。

Related: Can the url for the "Add to home screen" on iPhone Safari be customized?

相关:可以自定义 iPhone Safari 上“添加到主屏幕”的 url 吗?

回答by bcampolo

I just tried this on the iPhone 6.

我刚刚在 iPhone 6 上试过这个。

  1. Go to Settings and turn Airplane Mode to ON
  2. Go to Safari and type in the address you want to have an icon for
  3. Click Go. The page will fail to load, but the address will stay the same.
  4. Click the AirDrop icon next to the URL entry bar (landscape mode) and click the + button.
  5. Change the name of the site to whatever you want the icon caption to be
  6. Go to Settings and turn Airplane Mode to OFF
  1. 转到设置并将飞行模式打开
  2. 转到 Safari 并输入要为其添加图标的地址
  3. 单击“前往”。页面将无法加载,但地址将保持不变。
  4. 单击 URL 输入栏(横向模式)旁边的 AirDrop 图标,然后单击 + 按钮。
  5. 将站点名称更改为您希望图标标题的任何名称
  6. 转到设置并将飞行模式关闭

回答by sillygwailo

If you install the iPhone Configuration Utility, you can make custom icons on the home screen with custom URLs(including app URL schemes as long as you're OK with going through Safari first). It does not require jailbreaking or a connection to the Internet.

如果您安装 iPhone 配置实用程序,您可以使用自定义 URL(包括应用程序 URL 方案,只要您可以先通过 Safari)在主屏幕上制作自定义图标。它不需要越狱或连接到互联网。

回答by Rawan-25

Yes, you can create custom URL and icon with the help of .mobileconfig file.. there is a trick, First create mobileconfig file with the of "Apple Configurator 2" and link it with your html or web page such as a button.. If need any help then please let me know...

是的,您可以借助 .mobileconfig 文件创建自定义 URL 和图标。有一个技巧,首先使用“Apple Configurator 2”创建 mobileconfig 文件,然后将其与您的 html 或网页(例如按钮)链接。如果需要任何帮助,请告诉我...