6

Is it possible to have a link work in a Safari popover? I've done just about everything I can think of, but it appears that the adding links to popovers only changes the appearance, and doesn't result in anything clickable, either with href or onclick.

Wladimir Palant
  • 56,865
  • 12
  • 98
  • 126
Sunookitsune
  • 327
  • 1
  • 2
  • 9

2 Answers2

7

You can add onclick listener on href or div

.onclick = safari.application.activeBrowserWindow.openTab().url = "http://www.yourdomain.com/";
Massimiliano Kraus
  • 3,638
  • 5
  • 27
  • 47
Dmitriy
  • 399
  • 2
  • 6
  • Do you have a more full code example? I tried what you said with `$('#target0').onclick = function(){safari.application.activeBrowserWindow.openTab().url = "http://www.yourdomain.com/"};` and it didn't work either. I initially did `$('#target0').onclick = safari.application.activeBrowserWindow.openTab().url = "http://www.yourdomain.com/";`, but it just opened a new tab to yourdomain.com immediately. – Sunookitsune Apr 17 '12 at 13:10
  • You can't use .onclick with jQuery objects. Try `$('#target0').click(function(){...})` or `$('#target0').on('click', function(){...})` instead. – chulster Apr 17 '12 at 21:43
  • 1
    var successDiv = document.getElementById('statusBlogSpan'); successDiv.onclick = safari.application.activeBrowserWindow.openTab().url = "http://www.yourdomain.com/"; Try it. – Dmitriy Apr 18 '12 at 05:02
  • @canisbos The `.on('click', ...)` worked, the other didn't. Thanks a lot, I was about to give up on this. – Sunookitsune Apr 20 '12 at 13:02
0
var link = document.querySelector('#~~~');
link.addEventListener("click", function(event) {
    safari.application.activeBrowserWindow.openTab().url = "http://~~"
})
goodhyun
  • 4,814
  • 3
  • 33
  • 25