问题
safari.application.activeBrowserWindow.activeTab.url
is always undefined
.
Any idea why this might be?
回答1:
My impression is that this happens when the loaded page is not “allowed” in the Extension Website Access section of the extension’s configuration.
Only the websites you choose have web content injected into them, and only those websites can be manipulated using the
tab
object’s properties, such astitle
andurl
.
Also, it seems that the Whitelist and Blacklist settings are applied “on top of” whatever is allowed by Extension Website Access.
First, access is limited by the Extension Website Access settings, then the whitelist and blacklist are applied.
来源:https://stackoverflow.com/questions/8140730/current-url-in-safari-extension