+1
Є відповідь

Building "back" and "forward" action for web tag

sstava 11 років тому оновлений 11 років тому 2
What is a good approach to implementing back/forward browser navigation capabilities for a web tag?

I am assuming it is not a capability of the web tag, natively?

I have started an implementation that tracks the "moves" between pages and stores the "from url" and the "to url" to allow tracking back and forth...it isn't pretty (and not working well at the moment) and as such I am hoping to "steal" a better implementation or idea from the community.

Thanks!
Steve
We have a much better implementation for this now. Using the event tag, the web tag can track and return back and forward actions. Please see the example below:


<wire>
<main>
<panel name="loader" alias="LOAD" width="100" height="100" background="#ff0000" valign="center" align="center" onclickup="show-web" alpha="1">
<text name="label" width="100%" height="100%" color="#ffffff" font="Helvetica" size="20" alignment="center" text="Load Web"></text>
</panel>
<panel name="Browser" alias="BROWSER" width="100%" height="100%" xpos="100%" alpha="0">
<panel name="toolbar" width="100%" height="8%" background="#0c181a">
<panel name="highlight" width="100%" height="1" valign="bottom" background="#b0aba4" alpha=".5"></panel>
<panel name="back" width="50" height="34" valign="center" cornerradius="3" background="ffffff" onclickup="close-web" xpos="10">
<text name="backtext" width="100%" height="100%" color="#000000" font="HelveticaNeue-Bold" size="12" alignment="center" text="Back"></text>
</panel>
<panel name="back" width="55" height="34" valign="center" cornerradius="3" background="ffffff" onclickup="back" xpos="75">
<text name="backtext" width="100%" height="100%" color="#000000" font="HelveticaNeue-Bold" size="12" alignment="center" text="Return"></text>
</panel>
<panel name="forward" width="55" height="34" valign="center" cornerradius="3" background="ffffff" onclickup="forward" xpos="145">
<text name="forwardtext" width="100%" height="100%" color="#000000" font="HelveticaNeue-Bold" size="12" alignment="center" text="Forward"></text>
</panel>
</panel>
<web name="web" alias="WEB" width="100%" height="92%" url="about:blank" pagetofit="yes" valign="bottom"></web>
</panel>
</main>

<actions>
<action name="show-web">
<sync loop="no" startdelay="0">
<load url="http://rarewire.com" target="WEB" />
<alpha value="1" target="BROWSER" />
<translate xpos="0%" time=".5" target="BROWSER" />
</sync>
</action>
<action name="close-web">
<sync loop="no" startdelay="0">
<translate xpos="100%" time=".5" target="BROWSER" />
<alpha value="0" target="BROWSER" />
<load url="about:blank" target="WEB" />
</sync>
</action>
<action name="back">
<if lhs="[object:WEB.cangoback]" operator="e" rhs="yes">
<event type="back" target="WEB"/>
</if>
</action>
<action name="forward">
<event type="forward" target="WEB"/>
</action>
</actions>
</wire>
+1
That's great! You made my day with this one. Thanks.