Css and image load times

Discussion in 'HTML' started by Gin, Jul 9, 2007.

  1. Gin

    Gin Guest

    How to load first an image that I'm positioning using css ?

    The image is loaded after all the images on my html template.

    I'm using css for simplicity, because with it I can position this image on
    the top left side of my page, without complex
    html table architectures.

    Thank you
     
    Gin, Jul 9, 2007
    #1
    1. Advertising

  2. Scripsit Gin:

    > How to load first an image that I'm positioning using css ?


    The loading order can be affected in JavaScript, on browsers that have
    scripting enabled. For example, put the following right after the <html> tag
    (so that the code will be executed as early as possible):

    <script type="text/javascript">
    if(document.images) {
    img1 = new Image();
    img1.src = "foobar.gif"; }
    </script>

    (It's old-style JavaScript, but should work well enough.)

    > The image is loaded after all the images on my html template.


    The loading order depends on many things, including their order of
    appearance in the HTML source.

    > I'm using css for simplicity, because with it I can position this
    > image on the top left side of my page, without complex
    > html table architectures.


    That's fine. If you use the same image, with exactly the same URL (after
    relative URLs have been resolved to absolute URLs), then browsers will most
    probably cache the image so that it is practice readily available after a
    user has visited one of your pages. (Unless you do something to prevent
    caching; but you probably don't.)

    --
    Jukka K. Korpela ("Yucca")
    http://www.cs.tut.fi/~jkorpela/
     
    Jukka K. Korpela, Jul 9, 2007
    #2
    1. Advertising

  3. Gin

    Neredbojias Guest

    Well bust mah britches and call me cheeky, on Mon, 09 Jul 2007 13:56:08
    GMT Jukka K. Korpela scribed:

    > Scripsit Gin:
    >
    >> How to load first an image that I'm positioning using css ?

    >
    > The loading order can be affected in JavaScript, on browsers that have
    > scripting enabled. For example, put the following right after the
    > <html> tag (so that the code will be executed as early as possible):
    >
    > <script type="text/javascript">
    > if(document.images) {
    > img1 = new Image();
    > img1.src = "foobar.gif"; }
    > </script>


    Probably should be: var img1 = new Image();

    --
    Neredbojias the human
     
    Neredbojias, Jul 9, 2007
    #3
  4. Gin

    Gin Guest

    Thank you, probably you are right, the image now is at the bottom of the
    page, moving it on top can solve something

    Bye

    "Jukka K. Korpela" <> ha scritto nel messaggio
    news:x5rki.189057$...
    > Scripsit Gin:
    >
    > > How to load first an image that I'm positioning using css ?

    >
    > The loading order can be affected in JavaScript, on browsers that have
    > scripting enabled. For example, put the following right after the <html>

    tag
    > (so that the code will be executed as early as possible):
    >
    > <script type="text/javascript">
    > if(document.images) {
    > img1 = new Image();
    > img1.src = "foobar.gif"; }
    > </script>
    >
    > (It's old-style JavaScript, but should work well enough.)
    >
    > > The image is loaded after all the images on my html template.

    >
    > The loading order depends on many things, including their order of
    > appearance in the HTML source.
    >
    > > I'm using css for simplicity, because with it I can position this
    > > image on the top left side of my page, without complex
    > > html table architectures.

    >
    > That's fine. If you use the same image, with exactly the same URL (after
    > relative URLs have been resolved to absolute URLs), then browsers will

    most
    > probably cache the image so that it is practice readily available after a
    > user has visited one of your pages. (Unless you do something to prevent
    > caching; but you probably don't.)
    >
    > --
    > Jukka K. Korpela ("Yucca")
    > http://www.cs.tut.fi/~jkorpela/
    >
     
    Gin, Jul 11, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?bWF2cmlja18xMDE=?=

    SetAuthCookie works some times and fails some times?

    =?Utf-8?B?bWF2cmlja18xMDE=?=, Mar 23, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    521
    =?Utf-8?B?bWF2cmlja18xMDE=?=
    Mar 23, 2006
  2. =?Utf-8?B?bWF2cmlja18xMDE=?=

    Forms Authentication Fails some times and not some times???

    =?Utf-8?B?bWF2cmlja18xMDE=?=, Mar 28, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    497
    =?Utf-8?B?bWF2cmlja18xMDE=?=
    Mar 28, 2006
  3. djskrill
    Replies:
    9
    Views:
    704
    djskrill
    Oct 1, 2003
  4. Peng Yu
    Replies:
    17
    Views:
    698
    Peng Yu
    Sep 14, 2008
  5. Jack Steven
    Replies:
    2
    Views:
    450
    Chris Rebert
    Mar 9, 2009
Loading...

Share This Page