shawn <shawn@noemail.nowhere.com> wrote:
> Hi,
>
> My question is does anyone know the difference between specifying a relative
> path such as
> <img src="images/myimg.gif"> and full URL
> <img src="http://mysite.com/images/myimg.gif">?
>
> Does the second one issue an additional http request? if so, i have all my
> images in a page with full URL, will that slow down the page download time?
It's generally better to use relative paths whenever possible because
you can move the pages easier, maintenance is easier, and it's just
cleaner.
Images and static content may be some-what different depending on scale,
If you've got: /app/somefile.cgi and /img/somefile.gif and are working
on a HUGE scale, doing an
http://img.example.com/img/somefile.gif and
http://app.example.com/app/somefile.cgi MAY be better because
it allows you to setup a web server optimized for static content
and another server optimized for applications. (Could do the same
with your app server configuration too though)
Web servers that are strictly configured to serve static content, with no
support for CGI, authentication, paths, re-writing or any other goodies can be
a lot faster and easier on system resources. In those extreme cases, I wouldn't
even recommend apache for static content.
In most cases, it's not worth the trouble. (Totally pointless if you can't run
multiple web servers on your ISP - And unless you've got root access, or an ISP
willing to do this, you can't)
Generally, it's better to use relative paths, it'll make your
life a lot easier if you do. (Especially if you work on the
pages offline or elsewhere)
> Best of all, is it possible to deliver both text/html and image/gif in one
> http request? I suspect that typically they are separate requsts to the
> server, right?
Depends on how the browser and web server are setup, they can be sent in
the same request, but I normally tell my browser not to do that because
it's kind of buggy.
Jamie
--
http://www.geniegate.com Custom web programming
guhzo_42@lnubb.pbz (rot13) User Management Solutions