Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #30419

window.onload not working when using Safari's back button

From Tuxedo <tuxedo@mailinator.com>
Newsgroups comp.lang.javascript
Subject window.onload not working when using Safari's back button
Date 2016-05-10 22:53 +0200
Organization albasani.net
Message-ID <ngthoj$v4f$1@news.albasani.net> (permalink)

Show all headers | View raw


Hello,

If I have a window.onload event called from in a script or in the body tag, 
for example:

window.onload=alert('hello');
or
<body onload="alert('hello')">

... and after having navigated away from the page via for example a link 
and if thereafter using the browser's back button, the onload event will 
occur again when returning to the original page in FF and in other 
browsers, but not in Safari for some reason - why not?

I tested on an Ipad. Presumably Safari on a desktop OSX behaves the same as 
on the Ipad. But Chrome, which is also utilising WebKit, behaves like FF in 
this respect, so the difference appears to be Safari specific.

Is it possible to detect if a page is returned to via the back button in 
Safari?

Many thanks for any advise.

Tuxedo

Back to comp.lang.javascript | Previous | NextNext in thread | Find similar | Unroll thread


Thread

window.onload not working when using Safari's back button Tuxedo <tuxedo@mailinator.com> - 2016-05-10 22:53 +0200
  Re: window.onload not working when using Safari's back button JJ <jj4public@vfemail.net> - 2016-05-11 14:01 +0700
    Re: window.onload not working when using Safari's back button Tuxedo <tuxedo@mailinator.com> - 2016-05-11 21:39 +0200

csiph-web