Apple URL Scheme Reference
来源:互联网 发布:淘宝卖家举报买家诈骗 编辑:程序博客网 时间:2024/05/16 23:53
Note: This document was previously titled iPhone URL Scheme Reference. This document describes several URL schemes that are supported by system applications on iOS and Mac OS X. Native iOS applications and web applications running in Safari on any platform can use these schemes to integrate with system applications and provide a more seamless experience for the user. For example, if your iOS application displays telephone numbers, you could use an appropriate URL to launch the Phone application whenever someone taps one of those numbers. Similarly, clicking an iTunes link, launches the iTunes application and plays the song specified in the link. What happens when a user clicks a link depends on the platform and the installed system applications. This document describes those schemes that require special attributes or special formatting in order to be understood by the associated system application. As a result, this document does not describe all URL schemes supported on different Apple platforms. You should read this document if you want to launch a system application from your iOS application or from your web application running in Safari. This document contains both Cocoa Touch sample code—using the Introduction
openURL:
method of the shared UIApplication
object to open URLs—and HTML samples. For more information on how to use the openURL:
method, see UIApplication Class Reference.
The HTML link: Native application URL string: You can also include a subject field, a message, and multiple recipients in the To, Cc, and Bcc fields. (In iOS, the For detailed information on the format of the iOS Note: If the Mail application is not installed on the device, clicking a Mail Links
mailto
scheme is used to launch the Mail application 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 iOS applications.<a href="mailto:frank@wwdcdemo.example.com">John Frank</a>
mailto:frank@wwdcdemo.example.com
from
attribute is ignored.) The following example shows a mailto
URL that includes several different attributes:mailto:foo@example.com?cc=bar@example.com&subject=Greetings%20from%20Cupertino!&body=Wish%20you%20were%20here!
mailto
scheme, see RFC 2368.mailto
URL displays an appropriate warning message to the user.
Text Links
Note: Text links are supported on iOS only.
The sms
scheme is used to launch the Text application. 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.
The following examples show strings formatted for Safari and for native applications.
HTML links:
<a href="sms:">Launch Text Application</a>
<a href="sms:1-408-555-1212">New SMS Message</a>
Native application URL strings:
sms:
sms:1-408-555-1212
iOS Note: If the Text application is not installed on the device, clicking an sms
URL displays an appropriate warning message to the user.
The maps URL scheme is used to show geographical locations and to generate driving directions between two points. If your application includes address or location information, you can use map links to forward that information to the Maps application on iOS and the Google Maps website on other platforms. Unlike some schemes, map URLs do not start with a “maps” scheme identifier. Instead, map links are specified as regular HTML link: Native application URL string: The following examples show the strings you would use to provide driving directions between San Francisco and Cupertino: HTML link: Native application string: iOS Note: If the Maps application is not installed on the device, opening a map URL forwards the request to the Google Maps website. Although the Maps application supports many of the Google Maps parameters and queries, it does not support them all. The rules for creating a valid map link are as follows: The domain must be The path must be The path cannot be All parameters must be supported. See Table 1 for list of supported parameters. A parameter cannot be The parameters cannot include Table 1 lists the parameters supported by iOS along with a brief description of each. For a complete description of these parameters, see Google Map Parameters. Parameter Notes q= The query parameter. This parameter is treated as if it had been typed into the query box by the user on the maps.google.com page. near= The location part of the query. ll= The latitude and longitude points (in decimal format, comma separated, and in that order) for the map center point. sll= The latitude and longitude points from which a business search should be performed. spn= The approximate latitude and longitude span. sspn= A custom latitude and longitude span format used by Google. t= The type of map to display. z= The zoom level. saddr= The source address, which is used when generating driving directions daddr= The destination address, which is used when generating driving directions. latlng= A custom ID format that Google uses for identifying businesses. cid= A custom ID format that Google uses for identifying businesses.Map Links
http
links but are targeted at the Google Maps servers. The following examples show the strings you would use in Safari and in a native application to show a map of the city of Cupertino, California.<a href="http://maps.google.com/maps?q=cupertino">Cupertino</a>
http://maps.google.com/maps?q=cupertino
<a href="http://maps.google.com/maps?daddr=San+Francisco,+CA&saddr=cupertino">Directions</a>
http://maps.google.com/maps?daddr=San+Francisco,+CA&saddr=cupertino
google.com
and the subdomain must be maps
or ditu
./
, /maps
, /local
, or /m
if the query contains site
as the key and local
as the value./maps/*
.q=*
if the value is a URL (so KML is not picked up).view=text
or dirflg=r
.q=*
is not supported
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. The following examples show the strings you would use in Safari and in a native iOS application 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. HTML link: Native application URL string: For more information on creating iTunes links, see iTunes Link Maker FAQ. That webpage contains a link to the iTunes Link Maker tool. iTunes Links
<a href="http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewAlbum?i=156093464&id=156093462&s=143441">
<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>
http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewAlbum?i=156093464&id=156093462&s=143441
YouTube Links
The YouTube URL scheme is used to launch the YouTube application or connect to the YouTube website to play the specified video. If your application links to YouTube content, you can use this scheme to play videos from your application.
Unlike some schemes, YouTube URLs do not start with a “youtube” scheme identifier. Instead, they are specified as regularhttp
links but are targeted at the YouTube server. The following examples show the basic strings you would use in Safari and in an application 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:
HTML links:
<a href="http://www.youtube.com/watch?v=VIDEO_IDENTIFIER">Play Video</a>
<a href="http://www.youtube.com/v/VIDEO_IDENTIFIER">Play Video</a>
Native application 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.
Note: Phone links are supported on iOS only. The You can specify phone links explicitly in both web and native iOS applications using the HTML link: Native application URL string: To prevent users from maliciously redirecting phone calls or changing the behavior of a phone or account, the Phone application supports most, but not all, of the special characters in the 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 Listing 1 shows a simple webpage in which automatic telephone number detection is off. When displayed in Safari on iOS, the Listing 1 Turning telephone number detection off iOS Note: If the Phone application is not installed on the device, opening a Phone Links
tel
URL scheme is used to launch the Phone application and initiate dialing of the specified phone number. Tapping a telephone link on a webpage displays an alert asking if the user really wants to dial the phone number and initiates dialing if the user accepts. In a native application, opening a URL with the tel
scheme initiates dialing without further prompting from the user.tel
URL scheme. The following examples show the strings formatted for Safari and for a native application:<a href="tel:1-408-555-5555">1-408-555-5555</a>
tel:1-408-555-5555
tel
scheme. Specifically, if a URL contains the *
or #
characters, the Phone application does not attempt to dial the corresponding phone number. If your application 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 applications, use the stringByAddingPercentEscapesUsingEncoding:
method ofNSString
to escape characters, which returns a properly escaped version of your original string.format-detection
meta tag as follows:<meta name = "format-detection" content = "telephone=no">
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.<!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>
tel
URL displays an appropriate warning message to the user.
- Apple URL Scheme Reference
- Apple Blocked The 41 App URL Scheme on iOS 10
- URL Scheme
- URL Scheme
- URL Scheme
- URL Scheme
- URL Scheme
- url scheme
- Reference Url
- svn: Unrecognized URL scheme
- ios URL Scheme
- svn: Unrecognized URL scheme
- URL Scheme 统计
- 常用URL Scheme附录
- 关于URL Scheme
- ios URL Scheme
- 自定义URL Scheme
- 理解URL scheme
- 黑马程序员:static(统计产生实例对象的个数)
- 从ITpub搬家到CSDN
- 生活
- 黑马程序员:单态设计模式static(使类在内存只有一个实例对象)
- 国外程序员是如何准备面试的
- Apple URL Scheme Reference
- 第一次面试题目
- 整套Linux C开发视频教程web
- Groovy in SOAP UI
- linux useful command (always updating)
- 你可以调戏一下MBR(裸机的话)
- Android培训班(55)Dalvik虚拟机的目录结构
- div+css强制(不)换行
- C# 类的序列化[Serializable]