Friday, January 30, 2015

one weird trick for making a page think it's somewhere else

Haven't thought of this trick for years, but it's good to know about:

if you're ever updating a page that might, say, usually live on a remote server, but you want to edit it locally, and without pulling down all the css, images, etc, you can tell the page that all relative links actually should be based on a specific URL using the <base> tag... for instance, I'm editing the front of alienbill.com so I put
<base href="http://alienbill.com/">
at the top.

In effect, it makes pretend that the page is at that location for purposes of image references, stylesheets, etc.

FOLLOWUP: I update alienbill so its use of old school display tables and what not is no longer professionally embarrassing. If you view the source, you can see how I got the block effect; sometimes it's hard for us veterans to remember you get your anchor blocks to act a bit more like divs and what not.

No comments:

Post a Comment