2.7 Links
fragment
A URL can point to a section, or _________, of a document by adding a hash tag (#) and a ___________ identifier at the end of the URL.
Hyperlinks may only contain text. True or False
False, Placing an image in the hyperlink creates a graphical hyperlink.
file
Hyperlink used to refer to a document on the same computer as the web browser.
mailto
Hyperlink used to send email.
Should two elements in an HTML document have the same id attribute value? Yes No
No. (Each id attribute value must be unique within an HTML document, ensuring a URL with a fragment identifier refers to exactly one section of the document.)
The target attribute can be used on image links. True False
True, Both textual and image links can use the target attribute.
_blank attribute value
indicates the browser will open the link in a new tab or window.
graphical hyperlink
r image link uses an image inside a hyperlink instead of text. Ex: The HTML below uses an image of a dog that links to the American Kennel Club.
the opening <a> tag with the href attribute, the content displayed for the link , and the closing </a> tag.
A hyperlink has three parts:
Determine if the following are valid or invalid hyperlinks. <a href="#History">History</a> Valid Invalid
Valid, The #History fragment identifier specifies the History section of the index.html page.
absolute URL
a complete URL. Ex: <a href="http://example.com/test.html">test</a> is a hyperlink using the absolute URL http://example.com/test.html.
hyperlink
or link, specifies where other information is located and what action the web browser should perform when a user clicks the ________.
href attribute
specifies the hyperlink's URL.
relative URL
specifies the relative path to the web resource with no scheme or hostname. Ex: <a href="test.html">test</a> uses the relative URL test.html to refer to an HTML document on the same website and with the same path as the current HTML document.
Assume a directory called "junk" is located in the hobbies directory, and the junk directory contains the file stuff.html. What relative URL would stuff.html use to link to index.html? index.html ../index.html ../../index.html
../../index.html (The "../../" moves up two levels from junk to mywebsite, which contains index.html.)
id attribute, fragment identifier
Adding the _____________ to any HTML tag creates a ________, thus permitting URLs to link directly to the id's location in the document.
What does each of the following hyperlinks do? <a href="ftp://example.com/index.html">Raw data</a> Loads a page over an unencrypted connection Opens a file from the user's computer Downloads a file
Downloads a file (URLs that begin with "ftp://" use the FTP protocol to download a data file over the internet.)
What does each of the following hyperlinks do? <a href="https://example.com/index.html">See example</a> Loads a web page over an unencrypted connection Encrypts the web page load request and response Sends an email
Encrypts the web page load request and response (URLs that begin with "https://" use encrypted requests and responses over the web.)
displays the hyperlink as Wikipedia
Ex: <a href="https://wikipedia.org/">Wikipedia</a> _______________ and causes the browser to request the URL https://wikipedia.org/ when the hyperlink is clicked.
The web browser will always create a new window for hyperlinks whose target attribute is _blank. True False
False, The browser can open the link in a new tab or window. Many modern browsers will open the link in a new tab instead of opening a new window.
http
Hyperlink used to send requests and responses over the Internet without encryption.
https
Hyperlink used to send requests and responses that are readable only by the client and server.
ftp
Hyperlink used to transfer data files.
Determine if the following are valid or invalid hyperlinks. <a href="[email protected]">email me</a> Valid Invalid
Invalid, The content displayed for a hyperlink may be any valid HTML or text, including images.
Determine if the following are valid or invalid hyperlinks. <a href="example.com/index.html">See example</a> Valid Invalid
Invalid, The href attribute URL should include a scheme, such as https, when the URL includes a hostname.
What does each of the following hyperlinks do? <a href="http://example.com/index.html">See example</a> Loads a page over an unencrypted connection Encrypts the page load request and response Opens a file
Loads a page over an unencrypted connection (URLs that begin with "http://" use unencrypted requests and responses over the web. )
What does each of the following hyperlinks do? <a href="file:///C:/example/index.html">See example</a> Loads a page over an unencrypted connection Opens a file from the user's computer Downloads a file
Opens a file from the user's computer (URLs that begin with "file:///" open a file located on the user's computer. Links with file schemes are uncommon because files are usually expected to reside on web servers. )
What does each of the following hyperlinks do? <a href="mailto:[email protected]">Get in touch</a> Loads a page over an unencrypted connection Sends an email Opens a file
Sends an email (URLs that start with "mailto:" use an email program to send a message.)
The default value for the target attribute is _self. True False
True, By default when a hyperlink is clicked, the web browser will open the hyperlink in the same tab or window.
Determine if the following are valid or invalid hyperlinks. <a href="https://example.com/index.html#History">History</a> Valid Invalid
Valid, The #History fragment identifier specifies the History section of the index.html page.
Determine if the following are valid or invalid hyperlinks. <a href="https://example.org/index.html"> <img src="https://example.org/picture.jpg" alt="Picture of cat"></a> Valid Invalid
Valid, The content displayed for a hyperlink may be any valid HTML or text, including images.
Determine if the following are valid or invalid hyperlinks. <a href="course.html#Notes">Notes</a> Valid Invalid
Valid, The fragment identifier #Notes links to the Notes section of course.html, which is located in the same path.
target attribute
anchor tag's __________ indicates how the browser should display the link when clicked.
anchor tag <a>
defines a hyperlink in a web page.
In which file would you expect to find the hyperlink below? <a href="index.html">Home page</a> family.html football.html geocaching.html
family.html (The filename index.html is the complete relative URL because index.html is in the same directory as family.html.)
In which file would you expect to find the hyperlink below? <a href="../family.html">Family</a> index.html family.html geocaching.html
geocaching.html (geocaching.html is in the hobbies directory. The "../" references the directory that is one level up from hobbies, which is the mywebsite directory where family.html is located.)
Assume a directory called "junk" is located in the hobbies directory. What relative URL would index.html use to link to a file called stuff.html in the junk directory? stuff.html junk/stuff.html hobbies/junk/stuff.html
hobbies/junk/stuff.html The hobbies directory is in the same directory as index.html, the junk directory is in hobbies, and stuff.html is in junk.)
Which URL links to the "Governance" section of Wikipedia's Internet article? https://en.wikipedia.org/wiki/Internet https://en.wikipedia.org/wiki/Internet/Governance https://en.wikipedia.org/wiki/Internet#Governance
https://en.wikipedia.org/wiki/Internet#Governance (The fragment identifier "Governance" must follow the # character at the end of the URL.)
What is the paragraph's fragment identifier? <p id="location"> Two blocks north of 2nd street. </p> <p> location #location
location (The id attribute creates a fragment identifier.)
_self attribute value
the default and indicates the browser will open the link in the same tab or window.