+1
Respuestas

external link in Safari

dbdesign hace 12 años actualizado hace 12 años 2
I'm trying to get a simple example to work, having a text link, that when clicked opens a URL in Safari, but I can't figure out what I'm doing wrong?

Here is the code I'm trying:


<wire>

<main>
<panel name="panel" width="100%" height="100%" background="#ffffff">
<text name="main" width="110" height="100" color="#000000" font="courier" size="14" align="center" valign="center" text="Hello World!" onclick="xlink"></text>
<web name="browser" url="http://www.rarewire.com" pagetofit="yes"></web>
</panel>
</main>
<actions>
<action name="xlink">
<load external="yes" url="safari-http://www.rarewire.com" target="browser"/>
</action>
</actions>
</wire>
+1
You are very close here. A couple of things to note.

When you are using safari-http://www.rarewire.com as your URL, you don't need to add external="yes" that is only reserved for jumping out to other Apps that are not Safari.

Also you need to target your browser object differently. Because it is wrapped in a panel, you can use traditional pathing "../browser" or you can add an alias to your browser object and target that.

Here is a code sample:



<wire>
<main>
<panel name="panel" width="100%" height="100%" background="#ffffff">
<text name="main" width="110" height="100" color="#000000" font="courier" size="14" align="center" valign="center" text="Hello World!" onclick="xlink"></text>
<web name="browser" alias="BROWSER" url="http://www.rarewire.com" pagetofit="yes"></web>
</panel>
</main>
<actions>
<action name="xlink">
<load url="safari-http://www.rarewire.com" target="BROWSER"/>
</action>
</actions>
</wire>
updated my code to this, and it worked, thanks!


<wire>
<main>
<panel name="panel" width="100%" height="100%" background="#ffffff">
<text name="main" width="110" height="100" color="#000000" font="courier" size="14" align="center" valign="center" text="Hello World!" onclick="xlink"></text>
<web name="browser" url="http://www.rarewire.com" pagetofit="yes"></web>
</panel>
</main>
<actions>
<action name="xlink">
<load url="safari-http://www.rarewire.com" target="../browser"/>
</action>
</actions>
</wire>