Need Some Help? Have a Tip to Share?

Email me at MacTipper@gmail.com, or, leave a comment!

Subscribe To Our FREE RSS Feed!

Don't miss out on any posts from the Concise MacTipper Blog.

Thursday, October 1, 2009

Run AppleScript When Webpage is Done Loading

This AppleScript code will check if the Safari's frontmost window is done loading:

tell application "Safari"
delay 0.5
repeat until ((do JavaScript "document.readyState" in document 1) is "complete")
delay 0.25
end repeat

-- Action to perform once page is loaded.

end tell


This works with Safari 4 in both Leopard and Snow Leopard.

0 comments:

Post a Comment