Presentation is loading. Please wait.

Presentation is loading. Please wait.

UNIT 10 LINKS AND GEOLOCATION. OBJECTIVES  CO1 Describe various components of the Open Web Platform.  CO2 Create a website using HTML5.  CO3 Create.

Similar presentations


Presentation on theme: "UNIT 10 LINKS AND GEOLOCATION. OBJECTIVES  CO1 Describe various components of the Open Web Platform.  CO2 Create a website using HTML5.  CO3 Create."— Presentation transcript:

1 UNIT 10 LINKS AND GEOLOCATION

2 OBJECTIVES  CO1 Describe various components of the Open Web Platform.  CO2 Create a website using HTML5.  CO3 Create a website that is optimized for viewing on a mobile device. 2

3 LEARNING OUTCOMES LO49 Describe new link functionality in HTML5. LO50 Create a Web page that uses HTML5 link types. LO51 Describe the features of the geolocation API. LO52 Create a Web page that uses the geolocation API. 3

4 HOW LINKS HAVE CHANGED IN HTML5  and are more similar Both have the same attributes has additional attributes to deal with image maps ,, and have new relationships you apply using rel 4

5 LINK TYPES  Links to other documents as a text or image hyperlink.  When the link is clicked, the browser opens a new document.  Links to other documents as an image map.  Defines an area of an image that is clickable and when that area is clicked, the browser opens a new document.  Links to other documents to be used or referenced by the current document.  Most often used to reference style sheets, as in: 5

6 CHANGES TO THE ELEMENT  The name attribute is obsolete. Use id instead  The target attribute is no longer deprecated. Frames are no longer part of the HTML5 specification iframes still are, and you can reference specific iframes or windows with the target attribute  HTML5 also adds a media attribute to indicate with media queries the devices or media that the linked document is for. 6

7 LINKING TO POINTS WITHIN THE DOCUMENT  Mark the place in the document Linking Block-level Elements  Add the link Linking Block-level Elements 7 Each id attribute in the document should be unique.

8 target ATTRIBUTE  _blank Opens the linked document in a brand-new window (or tab)  _self Opens the linked document in the current window  _parent Opens the linked document in the parent browsing context  _top Opens the linked document at the top of the browsing context 8

9 USING IFRAMES This link points to a location in the iframe document. 9

10 LINKING A BLOCK OF ELEMENTS Come See our New Garden Our new garden is beautiful, lots of flowers and plants. Come see photos. 10

11 PLACEHOLDER LINKS  Links without an href Can't click me 11

12 ELEMENT Now includes the following attributes:  Rel This attribute indicates the relationship of the linked document to the current document.  Media Just like the element, this attribute adds media queries to indicate what media the linked document is for.  Hreflang This attribute was added to let you declare the language of the linked document. 12

13 hidden ATTRIBUTE Home Examples More Examples 13

14 hidden ATTRIBUTE Safari and Firefox  Not supported  Set style to display: none; 14

15 contextmenu ATTRIBUTE This link has a context menu 15

16 rel ATTRIBUTE 16 Link typeDescriptionEffect on and Effect on alternateAlternate representation of current document Hyperlink authorA link to the current document's author Hyperlink bookmarkThe permalink to the nearest ancestor HyperlinkNot allowed externalA link that is on a different site HyperlinkNot allowed helpContext-sensitive helpHyperlink

17 rel ATTRIBUTE 17 Link typeDescriptionEffect on and Effect on iconLink to an icon or faviconNot allowedExternal resource licenseLink to the copyright license for the document Hyperlink nextLink to the next document in the series Hyperlink nofollowNot endorsed by the current document's author AnnotationNot allowed

18 rel ATTRIBUTE 18 Link typeDescriptionEffect on and Effect on noreferrerTells user agent to send an HTTP Referer header AnnotationNot allowed pingbackThe address of the pingback server Not allowedExternal resource prefetchDownload document ahead of time External resource prevLink to the previous page in the series Hyperlink

19 rel ATTRIBUTE 19 Link typeDescriptionEffect on and Effect on searchSearch through the document and related pages Hyperlink sidebarA document that should be displayed in the sidebar Hyperlink stylesheetLink to a stylesheetNot allowedExternal resource tagThe address of a tag that applies to the current document Hyperlink

20 ALTERNATE LINK TYPE <a href="http://www.html5in24hours.com/" rel="canonical" hreflang="en"> 20

21 AUTHOR LINK TYPE <a href="/bio/Jennifer-Kyrnin-5105.htm" rel="author">Jennifer Kyrnin 21

22 BOOKMARK AND EXTERNAL LINK TYPES  Bookmark Most blogs use the bookmark type to identify the permalink for the post  External Use jQuery to cause external links to open in a new window $("[rel=external]").attr("target", "_blank"); 22

23 HELP, LICENSE, TAG, AND SEARCH LINK TYPES  Use to provide more information on the page  Browsers don't do anything special with them  License links to the license for the entire page 23

24 ICON LINK TYPE 24

25 NOFOLLOW AND NOREFERRER TYPES Use for:  Content you don't vouch for  Paid links  Pages search engines can't use 25

26 ADD MULTIPLE TYPES TO A LINK 26

27 PINGBACK TYPE  Pingback servers accept XML-RPC connections  Used to tell one website that another website has linked to it 27

28 PREFETCH TYPE Download the file during idle time 28

29 PREV AND NEXT TYPES  Most browsers don't do anything with them  Can use CSS styles with them 29

30  Only supported by Firefox and Opera  Opens a sidebar window when user clicks the link 30 SIDEBAR LINK TYPE

31 GEOLOCATION SOURCES  The IP address  The wireless network connection  The cell towers a phone is using  A dedicated global-positioning system (GPS) in the device 31

32 GEOLOCATION ACCURACY  Not always accurate  In general: IP address is accurate to the city Wireless network is accurate to 20 meters Cell towers is accurate to 100 meters Embedded GPS accurate to 10 meters 32

33 GEOLOCATION API BROWSER SUPPORT  Android 2.0  Chrome 5.0  Firefox 3.5  IE 9  iOS 3.0  Opera 10.6  Safari 5.0 33

34 USES FOR GEOLOCATION  Mapping  Photo locator  Fraud detection  Targeted advertising  Gaming 34

35 DETECTING SUPPORT FOR GEOLOCATION function supports_geolocation() { return !!navigator.geolocation; } 35

36 GEOLOCATION API METHODS  getCurrentPosition()  watchPosition()  clearWatch() 36

37  coords.latitude  coords.longitude  coords.accuracy  coords.altitude  coords.altitudeAccuracy  coords.heading  coords.speed  timestamp 37 POSITION OBJECT PROPERTIES Distances are metric Distances are metric

38 positionERROR OBJECT  PERMISSION_DENIED (1)  POSITION_UNAVAILABLE (2)  TIMEOUT (3)  UNKNOWN_ERROR(4) 38

39 getCurrentPosition METHOD function getLocation() { navigator.geolocation.getCurrentPosition( mapIt, locationError); } 39

40 SUCCESS METHOD function mapIt(position) { var lat = position.coords.latitude; var lon = position.coords.longitude; alert("You are at "+ lat + " latitude, and "+ lon +" longitude."); } 40

41 ERROR METHOD function locationError(error) { switch(error) { case 1: alert("Location services denied"); break; case 2: alert("Could not contact location services network" + "or satellites"); break; case 3: alert("Location services timed out"); break; default: alert("Location could not be determined."); } 41

42 watchPosition METHOD var watch; function getLocation() { watch = navigator.geolocation.watchPosition (mapIt, locationError); } 42

43 clearWatch METHOD function clearLocation() { navigator.geolocation.clearWatch (watch); } 43

44 OPTIONS FOR getCurrentPosition() AND watchPosition()  enableHighAccuracy getCurrentPosition(mapIt, locationError, {enableHighAccuracy: true});  Timeout getCurrentPosition(mapIt, locationError, {timeout: 90000});  maximumAge getCurrentPosition(mapIt, locationError, {maximumAge: 120000}); 44

45 SETTING ALL OPTIONS var positionOptions = { enableHighAccuracy: true, timeout: 90000, maximumAge: 120000 }; getCurrentPosition(mapIt, locationError, positionOptions); 45

46 PRIVACY AND GEOLOCATION Browsers require user permission to track location 46

47 MAP APIs  Bing Maps API http://www.microsoft.com/maps/developers/web.aspx  Google Maps JavaScript API https://developers.google.com/maps/  MapQuest Open API http://developer.mapquest.com/web/products/open  Ovi Maps API http://api.maps.ovi.com/devguide/overview.html 47


Download ppt "UNIT 10 LINKS AND GEOLOCATION. OBJECTIVES  CO1 Describe various components of the Open Web Platform.  CO2 Create a website using HTML5.  CO3 Create."

Similar presentations


Ads by Google