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 9097821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T00:12:43+00:00 2026-06-17T00:12:43+00:00

my goal is to auto-refresh some components with jquery when the page tab is

  • 0

my goal is to auto-refresh some components with jquery when the “page tab” is focussed. I have a “sort of cart” and i want to auto-update it even if you are displaying my site from more than 1 tab.
Also, i’m trying to make it work from an iframe inside a page!

is this possible or i must use some timer to auto-refresh periodically?

edit: after reading the solution i made it work once for every focus, don’t know if it’s the best solution but it gets the job done 😀

var focusPage = false;
var firstFocus = false;
$(window).focus(function () {
                focusPage = true;
                if (firstFocus) {
                    firstFocus = false;
                    //BAM! Refresh your stuff
                }
            });
$(window).blur(function () {
                    focusPage = false;
                    firstFocus = true;
                });
  • 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-06-17T00:12:44+00:00Added an answer on June 17, 2026 at 12:12 am

    Using this seems to work well:

    $(document).ready(function () {
        $(window).focus(function () {
            console.log("bam!");
        })
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a similar goal as the person here: Using OSGi to implement auto-update
I have a neat little jQuery script I am working on. Goal: parent div
I want to do auto scaling using knife command line tool. My main goal
What is the goal of the auto keyword in C? With C++ 0x it
I am developing a simple WPF application without any auto layout. The goal is
Goal: Using a CRON task (or other scheduled event) to update database with nightly
My end goal is to have a fluid <img> that won't expand past an
My original goal is to build my own modal dialog. At some point, I
On this page: www.incfilms.net/services, my goal is to make that Advertising and Consulting picture
Is possible auto align in line 2 div without size ? The goal is

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.