How to use js functions from plugin


#1

Hi there,

I’m working on a quite simple prototype with a few pages displaying text and images. There is only one difficulty: I’d like to create a cookie when triggering actions on some pages (click or on page load) and I’d like to retrieve information from a cookie upon some user’s actions.
I started creating a plug-in on axure cloud which includes a junction in Java script that creates a cookie. It works well but the piece I’m missing is how to call that function from within the pages. I tried several options including the interaction to link a button on click with a external url where I use the fx definition to call the js function defined in the plugin but that does not seem to work.

Any idea?

Thanks all!


#2

This would normally be achieved using global variables, if you need to move information from page to page within a prototype. Is there a reason you wouldn’t use those?


#3

If you are needing to store information between browser sessions, then a true cookie would be needed. If you js function achieves creating, setting and getting cookies, you theoretically should be able to call it with “javascript injection” --just search this forum for that term to find lots of examples from users. I’ve not seen anything with actual cookies though. I’m not sure this would work with Axure’s prototype player either–which is a frameset. You might need to publish HTML (rather than use the local preview) and load the actual HTML pages (instead of the prototype player’s default start.html file.) Be warned that javascript injection is not officially supported by Axure.

If you simply need to pass data from one page to another, then you can use global variables, which will be WAY simpler and easier.


#4

Thanks for you answers!
Indeed I need to share information between browser sessions, that’s my issue.
I will look for js injection and see where I go from there, thanks.