How to Provide an Exit Button on a Web Page

Some webmasters prefer to provide viewers with a convenient "Exit" button on a Web page for many reasons. For one, it requires the viewer to scroll through the page, at least temporarily, before exiting, instead of clicking the browser exit button located in the top corner of the window. It's also a simple convenience for a user who has just completed some activity on the website, such as filling out a poll or entering form data. Adding an "Exit" button to a web page is a simple matter of adding a line of HTML code to your document.

Things You'll Need

  • HTML Editor
Show More

Instructions

    • 1

      Load your Web document in your HTML editor. Determine where you want to place the "Exit" button on the page, and then locate that section inside of your <body> tags.

    • 2

      Type the following in your preferred location:

      <form><input type=button value="Exit" onClick="javascript:window.close();"></form>

      The "onClick" JavaScript code automatically generates a button that closes the browser window. Replace "Exit" with any text, such as "Close Window."

    • 3

      Save your updated HTML document containing the "Exit" button and upload it to your Web server. Load the page in your Web browser to test the functionality. Clicking on the new "Exit" button should close the Web page. After clicking the button, your viewers will leave the Web page completely.

Related Searches:

References

Resources

Comments

You May Also Like

Related Ads

Featured