AppleScript URL from open safari window
URL is a property of a document or a property of a tab in a window, so use this:

if URL of document 1 is "www.google.com" then


or this:

if URL of current tab of window 1 is "www.google.com" then




Update, example of how to use the exists command:

tell application "Safari"
    set b to exists URL of document 1 -- this put false or true into the variable
    if b and URL of document 1 is "www.google.com" then
        -- do something
    end if
end tell