就像 Sebastian Bochan 提到的,这似乎是一个 Safari 问题,而不是一般的安全问题,它不允许使用 javascript 打开窗口。打开新窗口的请求需要像点击链接一样由用户发起,而不是通过 javascript 代码块;
虽然您已将文本设置为
<a href="http://www.google.com"> google </a>
Highcharts 为工具提示中的链接生成 SVG 跨度,并且该跨度具有打开一个窗口的 onclick 处理程序。请参阅下面为标志工具提示生成的默认 html/svg
<text x="8" y="21" zIndex="1" style="font-size:12px;color:#333333;width:200px;fill:#333333;">
<tspan style="font-size: 10px" x="8">Monday, Apr 25, 2011</tspan>
<tspan onclick="location.href="http://www.google.com"" x="8" dy="16" style="cursor: pointer;"> google </tspan>
</text>
Safari 将禁止 onclick="location.href=&quot;http://www.google.com&quot;"
幸运的是,Highcharts 允许您跳过 SVG,并在工具提示中使用直接 html。您需要做的就是将tooltip.useHTML 设置为true,默认情况下为false。瞧,现在为工具提示生成了以下 HTML,我相信 Safari 不会有这个问题,以为我自己无法尝试这个
<div class="highcharts-tooltip" style="position: absolute; left: 912px; top: 70px; visibility: visible;">
<span style="position: absolute; white-space: nowrap; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: rgb(51, 51, 51); margin-left: 0px; margin-top: 0px; left: 8px; top: 8px;" zindex="1">
<span style="font-size: 10px">Sunday, Mar 24, 18:34:45</span><br>
<a href="http://www.google.com"> google </a><br>
</span>
</div>
Demo @ jsFiddle