Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Auto refresh unloaded Safari pages on AirPort link up Web Browsers
I am not sure when this started happening, or if it happens to all machines, but it has become handy for me. Certain laptops, particularly older iBooks, when woken from sleep, can take a bit of time to restore their AirPort connections.

Generally, before it is up, I have attempted to load a webpage in Safari, and get the usual network error. In the past, I used to hit refresh repeatedly, until the connection finally came up and the page loaded.

You need not do any of this, however; just sit there, and as soon as the AirPort connection is up, Safari somehow knows to reload the page, all on its own.
    •    
  • Currently 2.33 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (3 votes cast)
 
[7,485 views]  

Auto refresh unloaded Safari pages on AirPort link up | 6 comments | Create New Account
Click here to return to the 'Auto refresh unloaded Safari pages on AirPort link up' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Auto refresh unloaded Safari pages on AirPort link up
Authored by: PaulRenegar on Dec 06, '05 08:52:51AM

This is neat, I didn't know that.

Is there any way to take advantage of this wireless-network-dection capability to run your own script? At my university, our wireless network requires that we login through a webpage.

I wrote a simple applescript that I can execute to login when ran, but would love to be able to get the script to run automatically!



[ Reply to This | # ]
Auto refresh unloaded Safari pages on AirPort link up
Authored by: sabi on Dec 06, '05 04:07:48PM
Yes, you can use SCNetworkReachability to register a callback.

I wrote a Python wrapper for it, which you can find in my LocationDo project (note that LocationDo is a general-purpose app at all, it does only exactly what I want, but you should be able to adapt it to do what you want). You can see how I use it in action.py:

class _LDURLWatcher(NSObject):
    def URLIsReachable_(self, notification):
        _openURL(notification.object())

_urlWatcher = _LDURLWatcher.alloc().init()
NSNotificationCenter.defaultCenter().addObserver_selector_name_object_(
    _urlWatcher, 'URLIsReachable:', SCNetworkReachability.SCNetworkIsReachable,
    None)

def openURL(url):
    hostname = NSURL.URLWithString_(url).host()
    if not SCNetworkReachability.notify_when_reachable(hostname, url):
        _openURL(url)
That'll give you exactly Safari-like behavior—the URL opening will be postponed until the connection is up. I use it for exactly what you describe, opening the login pages.

[ Reply to This | # ]
Auto refresh unloaded Safari pages on AirPort link up
Authored by: gklinger on Dec 06, '05 10:12:29AM

I'm lazy so I don't want to research to find out when this feature was added to Safari but I can say it has been there as long as I can remember. I wouldn't be surprised if it has been in there from day one.



[ Reply to This | # ]
Auto refresh unloaded Safari pages on AirPort link up
Authored by: Bobson on Dec 06, '05 01:30:29PM

AFAIK, It's been in Safari since they got rid of the pop-up error dialog and switched it to the local error page.

I use it all the time with RSS feeds. Even with no connection, I can view previously downloaded articles, open the ones I want to read in a new tab, and the next time I have a connection it'll go grab all those pages.



[ Reply to This | # ]
Auto refresh unloaded Safari pages on AirPort link up
Authored by: EddEdmondson on Dec 08, '05 02:48:27AM

Not wireless-specific. Applies to any network.



[ Reply to This | # ]
Auto refresh unloaded Safari pages on AirPort link up
Authored by: tokenfirstyear on Dec 08, '05 05:11:21AM