/ Published in: Bash
refreshes Chrome + Safari without bringing them into focus. If Chrome is hidden, then no refresh occurs.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
osascript >/dev/null <<EOL tell application "Safari" do JavaScript "if(window.location.hostname.indexOf('.local') != -1 || window.location.hostname.indexOf('.dev') || window.location.href.indexOf('file://') != -1) { window.location.reload(); }" in first document end tell EOL osascript > /dev/null <<'APPLESCRIPT' tell application "System Events" set isVisible to visible of process "Google Chrome" end tell tell application "Google Chrome" if isVisible then tell active tab of first window execute javascript "window.location.reload()" end tell end if end tell APPLESCRIPT exit 0