This article explains how to preview a web page on your hard drive before posting it to a web server, as well as tips for testing your page to make sure it works.
What to Know
Build your web page and save it to your hard drive. Open your web browser > File > Open.You can now browse the file saved on your hard drive.Make sure your pages are correctly set up for testing, and be sure to test in multiple browsers.
Build your Web page and save it to your hard drive.
Open your Web browser and go to the File menu and choose Open.
Browse the file you saved on your hard drive.
Testing Problems
There are a few things that may go wrong when testing your web pages on your hard drive rather than the Web server. Make sure that your pages are set up correctly for testing:
Build your Web page and save it to your hard drive.
Open your Web browser and go to the File menu and choose Open.
Browse the file you saved on your hard drive.
- Use fully-qualified absolute paths for links. You can use page-relative paths for your links, but the best way to test links before a page is live is to use the full path to the page you’re linking to. In other words, include the domain name in your links.
- Use page-relative paths for your images. While you can use the full URL for your images, if the page you’re testing is new, then chances are that your images aren’t uploaded to the server any more than the HTML is. By using paths to images that are relative to the current page, they will show up when you test the file on your hard drive.
- Check the paths to your CSS and JavaScript external files. There isn’t a good rule of thumb for using full-path or relative-path URLs for scripts and CSS files — it depends upon your site and what works best for you. Instead, you should verify that whatever file you’re pointing to has the most up-to-date information. For example, if you post a full-path URL for your CSS, you’ll need to upload that file to your server when you test.
Be Sure to Test in Multiple Browsers
Once you’ve browsed to your page in one browser, you can then copy the URL from the Location bar in the browser and paste it into other browsers on the same computer. When we building sites on Windows machines, test pages in the following browsers before uploading anything:
- Opera
- Firefox
- Safari
- Chrome
Once you’re sure the page looks right in the browsers you have on your hard drive, you can upload the page and test it again from the Web server. Once it’s uploaded, you should connect to the page with other computers and operating systems or use a browser emulator like BrowserCam to do extensive testing.
Get the Latest Tech News Delivered Every Day