Make Safari load background tabs

Solution 1:

I'm not aware of any way to alter Safari's default behavior, but this task can be automated easily enough if you have a means to run an AppleScript.

I use FastScripts and Keyboard Maestro myself, so I can assign global or app-specific keyboard shortcuts to my many scripts.

This AppleScript will reload every tab in Safari's front window.

----------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2011/08/09 20:33
# dMod: 2015/11/14 16:46
# Appl: Safari
# Task: Reload Every Tab in front window.
# Libs: ELb
# Osax: None
# Tags: @Applescript, @Safari, @Reload, @Tabs, @Front, @Window
----------------------------------------------------------------

try

   tell application "Safari"

      set tabList to tabs of front window

      repeat with theTab in tabList
         tell theTab to do JavaScript "location.reload(true)"
      end repeat

   end tell

on error e number n
   stdErr(e, n, true, true) of me
end try

----------------------------------------------------------------
--» HANDLERS
----------------------------------------------------------------
on stdErr(e, n, beepFlag, ddFlag)
   set e to e & return & return & "Num: " & n
   if beepFlag = true then
      beep
   end if
   if ddFlag = true then
      if n ≠ -128 then
         try
            tell application (path to frontmost application as text) to set ddButton to button returned of ¬
               (display dialog e with title "ERROR!" buttons {"Copy Error Message", "Cancel", "OK"} ¬
                  default button "OK" giving up after 30)
            if ddButton = "Copy Error Message" then set the clipboard to e
         end try
      end if
   else
      return e
   end if
end stdErr
----------------------------------------------------------------

On my system I've given it a keyboard shortcut of R, which is a good mnemonic for me.

It's easy enough to alter the script to reload every tab in every window.

----------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2011/08/09 20:33
# dMod: 2011/08/09 20:57
# Appl: Safari
# Task: Reload Every Tab in Every Window.
# Libs: None
# Osax: None
# Tags: @Applescript, @Reload, @Tabs, @Every, @Window
----------------------------------------------------------------------------

tell application "Safari"

    set tabList to tabs of windows

    repeat with theWindow in tabList
        repeat with theTab in theWindow
            tell (theTab's contents)
                do JavaScript "location.reload(true)"
            end tell
        end repeat
    end repeat

end tell

----------------------------------------------------------------------------

I use this one so rarely I haven't given it a keyboard shortcut and have to manually activate it from the FastScripts menu. (This is also a safeguard to keep me from hitting a hotkey by accident and having to wait for every tab to reload.)

-ccs