Apple 官方文檔:《Apple Scheme URL Reference》翻譯一篇。文雖短但里面還是有些有意思的東西。
This document describes several URL schemes that are supported by system apps on iOS, macOS, and watchOS 2 and later. Native iOS apps and web apps running in Safari on any platform can use these schemes to integrate with system apps and provide a more seamless experience for the user. For example, if your iOS app displays telephone numbers, you could use an appropriate URL to launch the Phone app whenever someone taps one of those numbers. Similarly, clicking an iTunes link launches the iTunes app and plays the song specified in the link. When a user clicks a link, what happens depends on the platform and the installed system apps.
本文檔介紹了在 iOS、macOS 和 watchOS2 及以上版本的 watchOS 中所支持的幾種系統 URL scheme。在任何平臺上運行的 iOS 原生 app 或者 Safari 中的 web app 都可以使用這些 scheme 來提供一種無縫連接的用戶體驗。打個比方,如果你的 iOS app 顯示了一串電話號碼,你可以在用戶點擊電話號碼的時候調用適當的URL來啟動“電話”這個系統 app 來打電話。同樣的,在點擊一個 iTunes 鏈接的時候啟動 iTunes app 并播放鏈接中指定的歌曲。當一個用戶點擊鏈接時,具體發生什么事情取決于當前操作系統和系統app。
This document describes those schemes that require special attributes or special formatting in order to be understood by the associated system app. As a result, this document does not describe all URL schemes supported on different Apple platforms.
這個文檔的目的是幫助讀者理解那些必須使用特殊格式才能和系統 app 關聯的 scheme。所以,這個文檔并沒有把所有 Apple 平臺上支持的 URL scheme 都列舉出來。
At a Glance
You should read this document if you want to launch a system app from your iOS or macOS app, or from your web app running in Safari. This document contains both Cocoa Touch sample code—using the openURL:options:completionHandler:
method of the shared UIApplication
object to open URLs—and HTML samples.
如果你想在 iOS app、macOS app 以及 Safari 的 web app 中啟動系統 app,那么應該先讀該文檔。這個文檔包含了 Cocoa Touch 中的例子——使用 UIApplication
單例中的 openURL:options:completionHandler:
方法,以及HTML中的例子。
Composing Items Using Mail
Use the mailto
scheme to open the Mail app and populate a new email with information.
使用 mailto
scheme 打開郵件 app 并使用附帶的信息生成新的郵件。
Mail Links
The mailto
scheme is used to launch the Mail app and open the email compose sheet. When specifying a mailto
URL, you must provide the target email address. The following examples show strings formatted for Safari and for native apps.
mailto
scheme 用來啟動 郵件 app 并打開郵件編寫頁面。當指定一個 mailto
URL的時候,你必須提供目標郵件的地址。以下的例子里列舉了 Safari 和 原生 app 中的 scheme 格式:
- HTML link:
<a href="mailto:frank@wwdcdemo.example.com">John Frank</a>
- Native app URL string:
mailto:frank@wwdcdemo.example.com
You can also include a subject field, a message, and multiple recipients in the To, Cc, and Bcc fields. (In iOS, the from
attribute is ignored.) The following example shows a mailto
URL that includes several different attributes:
你還可以在scheme中包含主題、郵件內容、多個收件人、多個抄送以及密送人。以下例子中展示了一個包含多種不同屬性的 mailto
scheme:
mailto:foo@example.com?cc=bar@example.com&subject=Greetings%20from%20Cupertino!&body=Wish%20you%20were%20here!
For detailed information on the format of the mailto
scheme, see RFC 2368.
有關 mailto
scheme 的詳細格式方案信息,請參閱 RFC 2368。
iOS Note: If the Mail app is not installed, clicking a
mailto
URL displays an appropriate warning message to the user.
iOS 提醒:如果 郵件 app 沒有安裝,那么在點擊
mailto
URL 的時候會顯示一個合適的警告給用戶。
Starting a Phone or FaceTime Conversation
Use the tel
and facetime
schemes to initiate telephone or video conversations.
使用 tel
和 facetime
scheme 開始通話或發起一個視頻會話。
Phone Links
The tel
URL scheme is used to launch the Phone app on iOS devices and initiate dialing of the specified phone number. When a user taps a telephone link in a webpage, iOS displays an alert asking if the user really wants to dial the phone number and initiates dialing if the user accepts. When a user opens a URL with the tel
scheme in a native app, iOS 10.3 and later displays an alert and requires user confirmation before dialing. (When this scenario occurs in versions of iOS prior to 10.3, iOS initiates dialing without further prompting the user and does not display an alert, although a native app can be configured to display its own alert.)
tel
URL scheme 用來啟動 iOS 上的 電話 app 并向指定的手機號碼撥號。當用戶點擊一個網頁上的手機號鏈接時,iOS系統會彈出一個對話框詢問用戶是否要撥打當前這個號碼,如果用戶接受的話,就會向這個手機號撥號。當一個用戶在 原生 app 上打開一個 tel
scheme 時,如果是 iOS10.3 以及更高的系統版本的話,在撥打之前也會彈出一個確認框。(當這種情況發生在10.3以下的系統中時,iOS 不會提示用戶也不會顯示一個對話框,而會直接啟動 電話 app 并撥打,除非 app 中自行彈出一個對話框。)
FaceTime in macOS 10.10 and later can also use the tel
URL scheme to launch the Phone app on an iOS device by using Handoff. This scenario works when FaceTime is configured to dial phone numbers (the default configuration) and the iOS device is connected to the same iCloud account as the Mac.
FaceTime 在 macOS 10.10 以及之后的系統中也可以使用 tel
URL scheme 然后通過 Handoff 啟動 iOS 設備上的 電話 app。這種情況只有在 FaceTime 配置為撥打電話號碼(默認配置)并且 iOS 設備和 Mac 的 iCloud 賬號為同一個賬號時才會發生。(否則在 macOS 上使用 tel
scheme 會直接打開 FaceTime app)。
You can specify phone links explicitly in both web and native iOS apps using the tel
URL scheme. The following examples show the strings formatted for Safari and for a native app:
在 web 和 原生 iOS app 上你都可以使用 tel
URL scheme。以下的例子展示了該 scheme 的規則:
- HTML link:
<a href="tel:1-408-555-5555">1-408-555-5555</a>
- Native app URL string:
tel:1-408-555-5555
To prevent users from maliciously redirecting phone calls or changing the behavior of a phone or account, the Phone app supports most, but not all, of the special characters in the tel
scheme. Specifically, if a URL contains the *
or #
characters, the Phone app does not attempt to dial the corresponding phone number. If your app receives URL strings from the user or an unknown source, you should also make sure that any special characters that might not be appropriate in a URL are escaped properly. For native apps, use the stringByAddingPercentEscapesUsingEncoding:
method of NSString
to escape characters, which returns a properly escaped version of your original string.
為了避免用戶撥打惡意重定向電話或者更改電話、賬號的行為,電話 app 支持 tel
scheme 中大部分但并非全部的特殊字符。具體來說,如果 URL 中包含 *
或者 #
字符,電話 app 不會嘗試撥打相應的手機號碼。如果你的 app 收到用戶或者未知來源的 URL 字符串,你應該確保 URL 中的特殊字符能夠被正確轉義。在原生 app 中,使用NSString
類中的 stringByAddingPercentEscapesUsingEncoding:
方法來轉義,該方法會返回轉義后的字符串。
In Safari on iOS, telephone number detection is on by default. However, if your webpage contains numbers that can be interpreted as phone numbers, but are not phone numbers, you can turn off telephone number detection. You might also turn off telephone number detection to prevent the DOM document from being modified when parsed by the browser. To turn off telephone number detection in Safari on iOS, use the format-detection
meta tag as follows:
在 iOS 的 Safari 瀏覽器上,電話號碼檢測是默認開啟的。但是如果你的網頁上包含一些被誤認為電話號碼的數字,你可以關閉電話號碼檢測。為了防止瀏覽器解析DOM時篡改電話號碼,你也可以關閉電話號碼檢測功能。使用 format-detection
標簽來關閉 iOS 中的 Safari 電話檢測功能,如下所示:
<meta name = "format-detection" content = "telephone=no">
Listing 2-1 shows a simple webpage in which automatic telephone number detection is off. When displayed in Safari on iOS, the 408-555-5555
telephone number does not appear as a link. However, the 1-408-555-5555
number does appear as a link because it is in a phone link.
2-1 清單展示了一個關閉電話檢測的簡單網頁。當網頁展示在 iOS 的 Safari 中時, 408-555-5555
并不會展示成鏈接的樣子。然而,1-408-555-5555
會被顯示成一個鏈接因為它確實是一個超鏈接(標簽)。
Listing 2-1 Turning telephone number detection off
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" >
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Telephone Number Detection</title>
<meta name = "viewport" content = "width=device-width">
<!-- Turn off telephone number detection. -->
<meta name = "format-detection" content = "telephone=no">
</head>
<body>
<!-- Then use phone links to explicitly create a link. -->
<p>A phone number: <a href="tel:1-408-555-5555">1-408-555-5555</a></p>
<!-- Otherwise, numbers that look like phone numbers are not links. -->
<p>Not a phone number: 408-555-5555</p>
</body>
</html>
iOS Note: If the Phone app is not installed on the iOS device, opening a
tel
URL displays an appropriate warning message to the user.
iOS 提醒:如果 電話 app 沒有安裝,那么在打開
tel
URL 的時候會顯示一個合適的警告給用戶。
For more information about the tel
URL scheme, see RFC 2806 and RFC 2396.
有關 tel
URL scheme 的詳細信息,請參閱 RFC 2806 和 RFC 2396。
FaceTime Links
The facetime
URL scheme is used to initiate a FaceTime call to a specified user. You can use the phone number or email address of a user to initiate the call. When a user taps a FaceTime link in a webpage, iOS confirms that the user really wants to initiate a FaceTime call before proceeding. When an app opens a URL with the facetime
scheme, iOS opens the FaceTime app and initiates the call without prompting the user. When opening FaceTime URLs on macOS, the system always prompts the user before initiating a call.
faceTime
URL scheme 用來給指定用戶發起 FaceTime 通話。你可以用戶的使用電話號碼或者郵件地址來發起。當用戶點擊一個網頁上的 FaceTime 鏈接時, iOS 系統會在繼續之前讓用戶進行確認。當一個 app 打開 facetime
URL時, iOS 不會提示用戶而是直接打開 FaceTime app。(實測iOS10以下不會提醒,iOS10及以上會彈出確認框)在 macOS 上打開 FaceTime URL 的時候,系統總是會在打開之前提醒用戶。)
You can specify FaceTime links explicitly in both web and native iOS apps using the facetime
URL scheme. The following examples show the strings formatted for Safari and for a native app:
在 web 和 原生 iOS app 上你都可以使用 facetime
URL scheme 來制定一個 FaceTime 鏈接。以下的例子展示了該格式的字符串:
- HTML links for FaceTime video calls:
<a href="facetime:14085551234">Connect using FaceTime</a>
<a href="facetime:user@example.com">Connect using FaceTime</a>
- HTML links for FaceTime audio calls (iOS only):
<a href="facetime-audio:14085551234">Connect using FaceTime</a>
<a href="facetime-audio:user@example.com">Connect using FaceTime</a>
- Native app URL strings for FaceTime video calls:
facetime://14085551234
facetime://user@example.com
- Native app URL strings for FaceTime audio calls (iOS only):
facetime-audio://14085551234
facetime-audio://user@example.com
To prevent users from maliciously redirecting calls or changing the behavior of a phone or account, the FaceTime app supports most, but not all, of the special characters in the facetime
schemes. Specifically, if a URL contains the *
or #
characters, the app ignores those characters when they are included after the phone number. If your app receives URL strings from the user or from an unknown source, use the stringByAddingPercentEscapesUsingEncoding:
method of NSString
to generate a properly escaped version of the original string before opening the URL.
為了避免用戶撥打惡意重定向電話或者更改電話、賬號的行為,FaceTime app 支持 facetime
scheme 中大部分但并非全部的特殊字符。具體來說,如果 URL 中包含 *
或者 #
字符,并且當這些字符都在電話號碼后面時,FaceTime app會忽略他們 。如果你的 app 收到用戶或者未知來源的 URL 字符串,你可以使用NSString
類中的 stringByAddingPercentEscapesUsingEncoding:
方法來轉義后在進行打開。
iOS Note: If the FaceTime app is not installed on the iOS device or Mac, opening a
facetime
URL displays an appropriate warning message to the user. Prior to iOS 7, the Phone app handled FaceTime calls.
iOS 提醒:如果在 iOS 或者 Mac 設備上 FaceTime app 沒有安裝,那么在打開
facetime
URL 的時候會顯示一個合適的警告給用戶。在 iOS7 之前則會由 電話 app 來處理這個 scheme。
Specifying Text Messages
Use the sms
scheme to compose a text message and specify a recipient.
使用 sms
scheme 來編寫短信并指定接收人。
SMS Links
iOS Note: SMS text links are supported on iOS only.
iOS 提醒:短信鏈接只支持 iOS 設備。
The sms
scheme is used to launch the Messages app. The format for URLs of this type is “sms:
<phone>”, where <phone> is an optional parameter that specifies the target phone number of the SMS message. This parameter can contain the digits 0 through 9 and the plus (+
), hyphen (-
), and period (.
) characters. The URL string must not include any message text or other information.
sms
scheme 用來啟動 短信 app。這個 URL 的格式是 “sms:
<手機號>”,<手機號>是一個可選參數,這是用來指定短信發送到誰的手機號上。這個參數里可以包含數字0~9,+
,-
,.
。這個 URL 字符串中不能包含包括短信文本在內的其他信息。
The following examples show strings formatted for Safari and for native apps.
- HTML links:
<a href="sms:">Launch Messages App</a>
<a href="sms:1-408-555-1212">New SMS Message</a>
- Native app URL strings:
sms:
sms:1-408-555-1212
Opening Locations in Maps
Use specially formatted URLs to open the Maps app and display directions or locations.
用特定格式的 URL 來打開 地圖 app 并顯示指定方向或者坐標。
Map Links
The maps URL scheme is used to show geographical locations and to generate driving directions between two points. If your app includes address or location information, you can use map links to open that information in the Maps app in iOS or macOS.
地圖 URL scheme 用來顯示地理位置以及兩個地點之間的導航。如果你的 app 包含地址或者位置信息,你可以使用 map 鏈接在 iOS、macOS 地圖 app 上打開該地址或位置。
Unlike some schemes, map URLs do not start with a “maps” scheme identifier. Instead, map links are specified as regular http
links and are opened either in Safari or the Maps app on the target platform.
map URL 不像其他一些 scheme 使用 "maps" 開頭。取而代之的是使用常規的 http
鏈接,并在 Safari 或者其他平臺的 地圖 app 中打開。
Table 5-1 lists the supported parameters along with a brief description of each.
表格 5-1 列舉了每個支持的參數以及其簡要說明。
Table 5-1 Supported Apple Maps parameters
Parameter | Meaning | Values |
---|---|---|
t |
The map type. If you don’t specify one of the documented values, the current map type is used. |
m (standard view)k (satellite view)h (hybrid view)r (transit view) |
q |
The query. This parameter is treated as if its value had been typed into the Maps search field by the user. Note that q=* is not supportedThe q parameter can also be used as a label if the location is explicitly defined in the ll or address parameters. |
A URL-encoded string that describes the search object, such as “pizza,” or an address to be geocoded |
address |
The address. Using the address parameter simply displays the specified location, it does not perform a search for the location. | An address string that geolocation can understand. |
near |
A hint used during search. If the sll parameter is missing or its value is incomplete, the value of near is used instead. |
A comma-separated pair of floating point values that represent latitude and longitude (in that order). |
ll |
The location around which the map should be centered.The ll parameter can also represent a pin location when you use the q parameter to specify a name. |
A comma-separated pair of floating point values that represent latitude and longitude (in that order). |
z |
The zoom level. You can use the z parameter only when you also use the sll parameter; in particular, you can’t use z in combination with the spn or sspn parameters. |
A floating point value between 2 and 21 that defines the area around the center point that should be displayed. |
spn |
The area around the center point, or span. The center point is specified by the ll parameter.You can’t use the spn parameter in combination with the z parameter. |
A comma-separated pair of floating point values that represent latitude and longitude (in that order). |
saddr |
The source address to be used as the starting point for directions.A complete directions request includes the saddr , daddr , and dirflg parameters, but only the daddr parameter is required. If you don’t specify a value for saddr , the starting point is “here.” |
An address string that geolocation can understand. |
daddr |
The destination address to be used as the destination point for directions.A complete directions request includes the saddr , daddr , and dirflg parameters, but only the daddr parameter is required. |
An address string that geolocation can understand. |
dirflg |
The transport type.A complete directions request includes the saddr , daddr , and dirflg parameters, but only the daddr parameter is required. If you don’t specify one of the documented transport type values, the dirflg parameter is ignored; if you don’t specify any value, Maps uses the user’s preferred transport type or the previous setting. |
d (by car)w (by foot)r (by public transit) |
sll |
The search location. You can specify the sll parameter by itself or in combination with the q parameter. For example, http://maps.apple.com/?sll=50.894967,4.341626&z=10&t=s is a valid query. |
A comma-separated pair of floating point values that represent latitude and longitude (in that order). |
sspn |
The screen span. Use the sspn parameter to specify a span around the search location specified by the sll parameter. |
A comma-separated pair of floating point values that represent latitude and longitude (in that order). |
Parameter | Meaning | Values |
---|---|---|
t |
地圖類型。如果你不指定文檔中的任何類型,那么會使用地圖當前的類型。 |
m (標準視圖)k (衛星視圖)h (混合視圖)r (交通視圖) |
q |
查詢參數。這個參數會被當成搜索值填入到地圖的搜索框中。注意 q=* 是不支持的。如果位置由 ll 或者 address 參數明確地指定,那么 q 參數會被當做標簽來對待。 |
經過URL編碼的字符串,用來描述搜索對象,比如“披薩”,或者需要被地理編碼的地點。 |
address |
地址。使用地址參數只會簡單顯示地址的位置,并不會執行搜索該地址的操作。 | 一個可以識別的地址字符串。 |
near |
搜索中的提示. 如果沒有 sll 參數或者該參數的值不完整,那么將會使用 near 的值代替。 |
用逗號分隔的浮點數分別表示緯度和經度。 |
ll |
表示地圖中心點的坐標。當你使用 q 參數指定一個名字時,ll 參數會作為一個大頭針放置在地圖上進行展示。 |
用逗號分隔的浮點數分別表示緯度和經度。 |
z |
縮放等級。z 參數只有在使用了 sll 參數后生效;一個比較特殊的地方是 z 不能和 spn 或者 sspn 參數共同使用。 |
用來顯示地圖中心點附近顯示多大區域的值,必須介于 2 和 21 之間。 |
spn |
地圖中心點附件的區域大小,或者說是跨度。中心點必須由 ll 參數進行指定。你不能同時使用 z 和 span 兩個參數。 |
用逗號分隔的浮點數分別表示緯度和經度。 |
saddr |
一個指定線路的起點位置。一個完整的線路包含 saddr ,daddr ,dirflg 3個參數構成,但是只有 daddr 參數是必須的。如果你不指定 saddr 參數,那么起始點就是當前位置。 |
一個可以識別的地址字符串。 |
daddr |
一個指定線路的目標位置。一個完整的線路包含 saddr ,daddr ,dirflg 3個參數構成,但是只有 daddr 參數是必須的。 |
一個可以識別的地址字符串。 |
dirflg |
交通方式。一個完整的線路包含 saddr ,daddr ,dirflg 3個參數構成,但是只有 daddr 參數是必須的。如果該參數是除了文檔內指定的類型以外,該參數將會被忽略;如果你不指定該參數,那么交通方式將會使用用戶之前指定的方式。 |
d (駕車)w (步行)r (公交) |
sll |
搜索的位置。你可以自己指定 sll 參數,并且可以與 q 參數組合使用。例如, http://maps.apple.com/?sll=50.894967,4.341626&z=10&t=s 是一個合法查詢URL。 |
用逗號分隔的浮點數分別表示緯度和經度。 |
sspn |
一個屏幕上的經緯度跨度。當使用 sll 參數指定搜索的位置時,你可以使用 sspn 參數指定經緯度跨度。 |
用逗號分隔的浮點數分別表示緯度和經度。 |
You can use the maps URL scheme to help the user:
- Perform a search
- Get directions to a location
- View a specific location
你可以使用地圖 URL scheme 幫助用戶完成下面這些操作:
- 搜索一個地點
- 給出前往指定地點的線路
- 查看一個指定的位置
To perform a search, supply a properly encoded URL string as the value of the q
parameter. For example:
使用一個經過編碼的正確的URL字符串作為 q
參數的值來執行搜索。舉個例子:
http://maps.apple.com/?q=Mexican+Restaurant
To specify a location for search, you can supply a value for the near
parameter, or combine the sll
parameter with either the z
or sspn
parameters. You can also set the map type using the t
parameter, as shown here:
在搜索指定位置時,你可以使用 near
參數,或者結合 z
或者 sspn
和 sll
參數共同使用。當然你也可以使用 t
參數來指定地圖類型,比如這樣:
http://maps.apple.com/?q=Mexican+Restaurant&sll=50.894967,4.341626&z=10&t=s
To provide navigation directions from one location to another, supply the start and destination addresses in the saddr
and daddr
parameters as shown below. You can also supply much more detail for the start and destination addresses than is shown here.
使用 saddr
和 daddr
參數來指定起始以及目的地位置,從而提供導航功能。你還可以提供比如下示例中更多的詳細參數。
http://maps.apple.com/?saddr=Cupertino&daddr=San+Francisco
To specify a transport type, you can use the dirflg
parameter as shown here:
如下所示,你可以使用 dirflg
參數指定交通方式:
http://maps.apple.com/?saddr=San+Jose&daddr=San+Francisco&dirflg=r
You can omit the start address when you want to provide directions “from here.” The following example shows a search from here that provides driving directions in a hybrid map.
當你想從當前位置開始查詢線路時,你可以忽略起始位置參數。下面這個例子展示了在混合地圖中使用駕車到達指定地點的線路。
http://maps.apple.com/?daddr=San+Francisco&dirflg=d&t=h
To display a specific location, use the ll
parameter to center the map at the specified position as shown here:
要顯示特定的位置,那么使用 ll
參數來指定地圖中心點的坐標,如下所示:
http://maps.apple.com/?ll=50.894967,4.341626
Another way to display a location is to specify an address, such as:
另一種顯示特定位置的方式是使用指定的地址,如下所示:
http://maps.apple.com/?address=1,Infinite+Loop,Cupertino,California
If you use both the ll
and address
parameters, ll
takes precedence over address
. If you include a name in the value of the q
parameter, Maps tries to match the name at the specified location.
如果你同時使用了 ll
和 addres
參數,那么會優先使用 ll
參數。如果你的參數中包含了 q
參數,那么 地圖 app 會嘗試在指定位置處匹配這個名稱。
Opening Items in iTunes
Use specially formatted URLs to open iTunes and display items in the iTunes Music Store.
用特定格式的 URL 來打開 iTunes app 并顯示 iTunes 音樂商店中的指定項目。
iTunes Links
The iTunes URL scheme is used to link to content on the iTunes Music Store. The iTunes URL format is complicated to construct, so you create it using an online tool called iTunes Link Maker. The tool allows you to select a country destination and media type, and then search by song, album, or artist. After you select the item you want to link to, it generates the corresponding URL.
iTunes URL scheme 用來鏈接到 iTunes 音樂商店。由于 iTunes URL 的格式比較復雜,所以你可以使用 iTunes Link Maker 這個在線工具來創建。通過該工具,你可以對國家、媒體類型進行篩選并搜索歌曲、專輯或藝術家。當你選擇了項目后會生成相應的 URL 。
The following examples show the strings you would use in Safari and in a native iOS app to link to a song on the iTunes Music Store. The HTML example includes the complete link returned by the iTunes Link Maker tool, which includes a link to any appropriate artwork for the target link.
下面這個例子展示了一個在 Safari 和 原生 iOS app 中可以使用的 URL 字符串。 HTML 例子中就包含了一個使用 iTunes Link Maker 工具生產的指向合適圖片的鏈接。
- HTML link;
<a >
<img height="15" width="61" alt="Randy Newman - Toy Story
- You've Got a Friend In Me" src="http://ax.phobos.apple.com.edgesuite.net/images/
badgeitunes61x15dark.gif"></img>
</a>
- Native app URL string:
http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewAlbum?i=156093464&id=156093462&s=143441
For more information on creating iTunes links, see iTunes Link Maker FAQ. That webpage contains a link to the iTunes Link Maker tool.
有關 iTunes
鏈接 的詳細格式方案信息,請參閱 iTunes Link Maker FAQ。該網站中包含了 iTunes Link Maker 工具的鏈接。
Opening YouTube Videos
Use specially formatted URLs to open YouTube videos in Safari.
在 Safari 中使用指定格式的 URL 打開 YouTube 視頻。
YouTube Links
The YouTube URL scheme is used to connect to the YouTube website to play the specified video. If your app links to YouTube content, you can use this scheme to play videos from your app.
YouTube URL scheme 用來打開 YouTube 網站并播放指定的視頻。如果你的 app 有鏈接到 YouTube 的內容,那么你可以從 app 中跳轉并播放視頻。
Unlike some schemes, YouTube URLs do not start with a “youtube” scheme identifier. Instead, they are specified as regular http
links but are targeted at the YouTube server. The following examples show the basic strings you would use in Safari and in an app to show a YouTube video. In each example, you would need to replace the VIDEO_IDENTIFIER
value with the identifier of the video you wanted to display:
YouTube URL 并不像其他 scheme 一樣以 "youtube" 開頭。而是使用指向 YouTube 服務的常規 http
鏈接。以下例子中展示了在 Safari 和 app 中用來展示 YouTube 視頻的基本字符串。在每個例子中你需要將 VIDEO_IDENTIFIER
替換成你想要播放的視頻 id :
- HTML links:
<a >Play Video</a>
<a >Play Video</a>
- Native app URL strings:
http://www.youtube.com/watch?v=VIDEO_IDENTIFIER
http://www.youtube.com/v/VIDEO_IDENTIFIER
iOS Note: If the YouTube video cannot be viewed on the device, iOS displays an appropriate warning message to the user.
iOS 提醒:如果在該 YouTube 視頻無法再設備上觀看,那么 iOS 系統會顯示一個合適的警告給用戶。