Exercise: Ensure links still work when Javascript is not supported or turned off
Exercise
View the home page of the tutorial site in your web browser, click the 'Contact information' link located near the foot of the page in the main content column.
A new window opens showing the contact information for Joe Light. (The window opened without first warning the user; this is bad practice, as it could confuse users, e.g. a blind person using a screen reader, particularly if they are not aware that a new window has openned).
Close the window you have just opened, turn off Javascript in your browser, and click the link again. Note that the link no longer works, as it was dependent on the use of Javascript. The contact information is no longer available via this link.
Open the tutorial file index.php in your editor and look for the following line (line 121):
<a href="JavaScript:window.open('contact.php')">Contact information</a>
Modify the code as shown in the following example, so that the link still works even when scripting is not available or has been turned off,
<a href="contact.php" target="newWindow" onclick="window.open(this.href, this.target); return false" >Contact Information</a>
Please note - opening new windows without warning is not good practice.
