Javascript page navigation


How can I navigate to a normal Axure “page” in javascript and keep global vars?

In my external .js file I tried $axure.internal(function($ax){ $ax.navigate(“page_2.html”); }); and this changes the page but loses the global vars?

I don’t know that I have a great answer for you, but a couple of things you could try:

  1. Since axure seems to do some magic on their own, have you tried putting the navigation inside of axure on an onMove event on a widget and then firing the onMove event on that widget via javascript? i’ve had good success doing that when I can’t quite get JS to do what axure does.

  2. Check out the axure ex library here - there are some functions that might work:
    There also appears to be a $axure(query).openLink(url, includeVariables) function that is part of the regular axure API, but I have not been able to get it to work.

  3. You could manually build out the URL - but this would require a bit of work and you’d need to patch the $axure.getGlobalVariable() function as it’s broken.

1 Like

Thanks for your response and I’m becoming very familiar with that site :stuck_out_tongue: after hours last night I think I almost got it and figured I should share here:

Instead of passing the url string you must pass an object {} as the includeVariables var is false by default

//$ax.navigate(url) – string doesn’t work

This works and keeps the global vars! but for some reason it doesn’t work in an iframe I keep getting a NS_MALFORMED_ERROR , but on a button/widget it seems to work :slight_smile:

Could you tell me how to trigger the onMove event from javascript? I wasn’t aware you can do that…could you also call fire events or other events on widgets from javascript?

$axure(’@name’).moveBy(0, 0, {});

where the ‘name’ gets replaced by the widget name set in the properties. so for example, if your button or whatever widget you are going to move is named MagicMover, you’d do:

$axure(’@MagicMover’).moveBy(0, 0, {});

the 0,0 is the x and y coordinates, the empty object is for options (animation, etc).

You can also show, hide, set selected, resize, set text etc. I haven’t ever used the fire event via JS. I would guess you can, but I have not dug in to figure it out.

Wow great I’ll look into those events more, thanks alot!!