gfreezy
gfreezy

Reputation: 98

Safari can not get url property from beforeNavigate event

Below is my global.htm for the safari extension. I inspected the global page, and wherever I clicked, the console alwarys said 'url: null'. My safari is 6.0.1 on Mountain Lion 10.8.2.

<script type="text/javascript">
var performCommand = function(event) {
    console.log(event);
    console.log("url:" + event.url);
};
console.log('in extension');
safari.application.addEventListener("beforeNavigate", performCommand, true);
</script>

Upvotes: 1

Views: 1047

Answers (1)

chulster
chulster

Reputation: 2829

It's a permission problem. In the Extension Builder, under Extension Website Access, you have to set the extension's access level to either Some or All. If Some, you also have to enter at least one URL pattern that covers the sites you want to include.

Upvotes: 2

Related Questions