/    Sign up×
Community /Pin to ProfileBookmark

how do i REFRESH on page FOCUS ?

how do i REFRESH on page FOCUS ?

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@CharlesAug 03.2005 — Try:<script type="text/javascript">
onload = function () {
onfocus = function () {location.reload (true)}
}
</script>
Copy linkTweet thisAlerts:
@ofirauthorAug 03.2005 — thanks BUT...

i need it to refresh only [B]ONCE[/B] when focused !!

and i need it on page and/or tab onfocus !
Copy linkTweet thisAlerts:
@ofirauthorAug 04.2005 — bump
Copy linkTweet thisAlerts:
@CharlesAug 04.2005 — <script type="text/javascript">
onload = function () {
onfocus = function () {
onfocus = function () {}
location.reload (true)
}
}
</script>
Copy linkTweet thisAlerts:
@BDuellOct 18.2012 — <script type="text/javascript">;

if (navigator.appName == "Microsoft Internet Explorer") {

$(window).load(function () {

$(window).load(function () {

self.location.reload (true);

});

});

} else {

window.addEventListener('load', function () {

self.name = '_refreshed_';

window.addEventListener('pageshow', function () {

if (self.name != '_refreshed_') {

self.location.reload(true);

}

}, false);

window.addEventListener('pagehide', function () {

self.name = '';

}, false);

window.addEventListener('focus', function () {

if (self.name != '_refreshed_') {

self.location.reload(true);

}

self.name = '';

}, false);

window.addEventListener('blur', function () {

self.name = '';

}, false);

}, false);

}

</script>
Copy linkTweet thisAlerts:
@Troy_IIIOct 19.2012 — refreshPage = function(){location = location;}

onfocus = function(){if(!refreshPage.refreshed)refreshPage();onfocus=null, delete refreshPage}
×

Success!

Help @ofir spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...