Basic questions about JS images

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • GeezerButler

    Basic questions about JS images

    I thought JS was purely on client side. But if i do myImage.src =
    'someImageOnSer ver.gif", it seems to work.
    How does JS do this?
    Is a request sent to the server when this line of code is executed? If
    yes, then what kind of technique does JS use for loading this image.
    OR
    Do browsers download all server images when an initial server request
    is made, put it in some client side cache and later JS accesses this
    cache.
    OR
    some other mechanism?
  • Thomas 'PointedEars' Lahn

    #2
    Re: Basic questions about JS images

    GeezerButler wrote:
    I thought JS was purely on client side.
    You thought wrong. Have you got this idea through a (bad) book by any chance?
    But if i do myImage.src = 'someImageOnSer ver.gif", it seems to work.
    However, there is no contradiction here. The code is probably executed
    client-side (there is an indication, but no necessity) which would make this
    client-side script code. What resources a code accesses is not relevant in
    order to decide where it is executed.
    How does JS do this?
    Client-side scripting frequently uses the capabilities of the Web client
    that provides its execution environment.
    Is a request sent to the server when this line of code is executed?
    That much would seem to be obvious for resources provided by a HTTP server.
    If yes, then what kind of technique does JS use for loading this image.
    The capabilities of the Web client.
    OR Do browsers download all server images
    An HTML user agent does not distinguish between client and server. The
    image is referenced by a URI or URI-reference, and the URI of the document
    or the URI of the supposed image resource defines how the Web client is
    acquiring the image data.
    when an initial server request is made, put it in some client side cache
    and later JS accesses this cache.
    No. The Web client usually has a cache (in memory or on disk). Client-side
    scripting can indirectly make use of this cache if it accesses features that
    are handled by the Web client.
    OR some other mechanism?
    What other mechanism could be there?


    PointedEars
    --
    Use any version of Microsoft Frontpage to create your site.
    (This won't prevent people from viewing your source, but no one
    will want to steal it.)
    -- from <http://www.vortex-webdesign.com/help/hidesource.htm>

    Comment

    Working...