Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6828187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:21:12+00:00 2026-05-26T22:21:12+00:00

My first problem : I am currently using $(window).load to delay the page render

  • 0

My first problem :
I am currently using $(window).load to delay the page render in order to load all images and then show it.

It does work with all <img> tags But it is not working with div tags that have background image. Lets say I have 30 image on my website template and 10 of them are from background specified in CSS.

Using the $(window).load function, 20 of those <img> images are loaded before the function fires. But the remaining 10 will be loaded when the page starts showing. So the webpage looks very ugly before it is completed.

How can I include those in my windows.load function?

Second problem:
Because I started making a webpage from scratch for the first time, the pages have a cache issue. I am going to explain what I mean.

The problem is that after I change something in HTML (adding or removing images, etc … ) When I try to reload the page on my browser to see the changes, The web page goes into crazy mode and it’s messed up. Unless I do a Full Refresh ( CTRL + F5 ). It doesn’t matter which browser I am using, The page looks messed up after doing either a small or big change in the HTML code.

This is not something normal in my situation. All website on the www are changing their template or part of their page every day/week and It looks so fine everything to enter.
I haven’t published my website yet, If I go doing changes on the code every time the user will see weird page.

What’s happening ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:21:13+00:00Added an answer on May 26, 2026 at 10:21 pm

    For the caching problem you could add a meta element that tells the browser not to cache the page :

    <meta http-equiv="PRAGMA" content="NO-CACHE">
    

    For your images, you could preload them and only after the images are loaded in the memory allow the browser to execute some script. An approach would look like this :

    $(window).load(function(){
        var elementsWithBg = $('*').filter(function(){
            return (bg = $(this).css('background-image')) != '' && bg != 'none'; 
        });
        var n = elementsWithBg.length;
        function callback(){
            if(n > 0)
                return;
            ready();
        }
        elementsWithBg.each(function(i,el){
            var img = new Image();
            img.onload = function(){
               n--; 
               callback();
            };
            img.src = $(this).css('background-image').replace(/url\(['"]?(.*?)['"]?\)/g,'$1');
        });
    });
    function ready(){
        // your code goes here
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Well, first of all, I hope I stated my problem correctly. I am using
Currently developing a PHP framework and have ran into my first problem. I need
It might sound unnecessary, but let me explain my problem first. Probably then it
I'm currently designing my first ever GUI for Windows. I'm using MFC and Visual
Its my first time using modal windows. And I'm currently using fancy box. But
I have a problem with a Ext.Grid.EditorGridPanel, I am currently using ExtJS 2.3.0, that
UPDATE: First problem solved, second one described at the bottom of this post. UPDATE2:
I just solved the first problem from Project Euler in JavaFX for the fun
I'm trying to use GSP outside grails and ran to my first problem. I
We have a couple of mirrored SQL Server databases. My first problem - the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.