Re: Getting Tab Index and Window ID in Safari
Re: Getting Tab Index and Window ID in Safari
- Subject: Re: Getting Tab Index and Window ID in Safari
- From: "Nigel Garvey" <email@hidden>
- Date: Mon, 22 May 2017 10:59:37 +0100
Christopher Stone wrote on Sun, 21 May 2017 18:25:26 -0500:
>On 05/21/2017, at 05:13, Nigel Garvey <email@hidden
><mailto:email@hidden>> wrote:
>> 1. I'm getting results for an invisible window with Safari 10.1.1 in
El
>>Capitan. It looks (after minimal testing) as if windows with tabs
showing
>>sites which plant cookies are only made invisible when they're "closed"
>>and are only deleted when Safari quits.
>
>Hey Nige,
>
>So far I've not experienced this, but I'm running Ghostery and Adblock.
>
>Can you point to a given URL that causes this repeatably?
Not one which causes it consistently, I'm afraid. It was happening
yesterday and this morning with <http://macscripter.net>, but has
stopped while I've been writing this up! :\ It _is_ happening at the
moment with <https://www.youtube.com>. It hasn't happened at all (yet)
with
<https://lists.apple.com/archives/applescript-users/2017/May/index.html>
. Presumably it's something to do with Safari's housekeeping.
1. Quit Safari and reopen it to start with just the default new window.
(I haven't tested yet with the preference set to "All windows from last
session".) Running this script …
tell application "Safari" to get tabs of windows
… should return something like:
{{tab 1 of window id 4353 of application "Safari"}}
2. Open a new Safari window and go to <http://macscripter.net> (or
<https://www.youtube.com>) in it. Running the script again will of
course produce something like:
{{tab 1 of window id 4369 of application "Safari"}, {tab 1 of window id 4353 of application "Safari"}}
3. Close the new window and run the script yet again. When the effect
happens, the script result contains the same two tab lists. When not, it
only contains the original.
The URL of "ghost" tabs is 'missing value', so they don't influence the
"tab containing a given URL" version of your script. But the fact that
the other version _can_ return false hits means it should ideally filter
for visible windows.
NG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden