Remember nodes with cookies

Post Reply
User avatar
Hopki
Gnome
Posts: 12999
Joined: Thu Jan 10, 2008 3:16 pm
Location: Layer de la Haye, Essex UK
Contact:

Here are two components that use cookies to remember the node and view when reopening a tour.

To use just add the component to your skin.
If not required you can delete the Forget Cookie text box, its only there to show how to clear the cookie.
Once added when you close the tour and reopen it, depending on which component you are using it will open with the last node or last node and view.

The first component RememberNode.ggskc just remembers the node.
This is done by a javascript call in a Go To URL action found in the container with the ID cookie.


How it works:
There is a variable in the skin called "lastnode".
The current node is written to the variable with a Node Changed action.
There is also a javascript call that creates a cookie and is continually updating it when the Configuration file is loaded.


The javascript:

Code: Select all

javascript: player.setVariableOptions("lastnode",{ keep:true, cookieExpireDays:100 });
As you can see the cookie will expire after 100 days.
So the cookie remembers the variable and when opened the action Config Loaded, Open Next Panorama then uses it to open the correct node.

The "forget button" removes the cookie by setting the days to 0.

The component RememberNodeView.ggskc uses a timer.
This is similar to the above but also has a timer that is recording the pan, tilt and FoV every second and writing to the variable, "lastview".
There is a javascript call to remember this, similar to the node.

The forget Cookie button has to have both javascript calls to set the days to 0.

Regards,
Hopki
Attachments
RememberNodeView.ggskc
(406.7 KiB) Downloaded 721 times
RemamberNode.ggskc
(410.63 KiB) Downloaded 595 times
Garden Gnome Support
If you send an e-mail to support please send a link to the forum post for reference.
support@ggnome.com
https://ggnome.com/wiki/documentation/
User avatar
Hrvoje
Posts: 171
Joined: Sat Feb 28, 2009 7:34 pm
Location: Zagreb, Croatia
Contact:

Hello

Is there a possible reason what might cause Reset button to stop working?
I started to use this option to remember node and to reset it with reset button few months ago and it worked well.
But it doesn't work anymore and I didn't change anything except to render projects with most recent version of Pano2VR.
Remember nodes still works which means that cookie is set, but functions on reset button doesn't work:

Code: Select all

javascript: player.setVariableOptions("lastnode",{ keep:true, cookieExpireDays:0 }); path="/;";
javascript: player.setVariableOptions("lastview",{ keep:true, cookieExpireDays:0 }); path="/;";
Did maybe something changed in latest Chrome or Firefox which forbids cookie to be deleted?

Edit: solved by changing actions on reset button.

Instead of 2 actions with javascript I used 2 actions to set "lastnode" and "lastview" vars empty


Thanks
Regards
Marco360
Posts: 23
Joined: Wed Feb 19, 2020 1:02 pm

isn't the cookiePath to be within the {}?!
like that?

Code: Select all

javascript: player.setVariableOptions("cookie1",{ keep:true,cookieExpireDays:7,cookiePath:"/" });
and:
does anyone has a hint/solution for cookie management for iframed tours (hosted on different domain than the website)? At the moment NO cookie of the tour is stored :?: THX
Marco360
Posts: 23
Joined: Wed Feb 19, 2020 1:02 pm

just a short add on:
There is no option to set a domain for the cookie, is it?
I'm thinking of .example.com instead of the actual (sub-)domain.

Thanks.
Post Reply