Browser Back Button Perspective

In Perspective I see that the browser’s back button work with navigation to the previous screen.
When going back the screen doesn’t react properly to the parameter that was passed in.

I have a script that populates repeaters on the screen based off of that parameter.
That script is called on both the property change script on the parameter itself and the page startup script.

I was using just the change script but when the back button wasn’t providing the desired behavior, I added the script to the startup script.

Anyone have any ideas of what to do here to make the page react to the parameter on a backwards browser navigation?

When you use the "back" button in your browser, the browser is making an HTTP get request for the previous URL. Unless your parameters were supplied through the URL, the parameters are not being resent. This is a limitation of Single Page Applications, which is what Perspective is; behind the scenes, there is only one page, we just restructure the displayed content based on the configuration in use.

There is no way to accomplish this in Perspective. Your best option is to not use a param value, and instead set a session property. This could be done before you perform the navigation, and would then be resilient against a user using the "back" button.

Are you saying to specify the parameter value in the URL? and not a session property?
If so, that’s what I’m doing. The URL contains the parameter at the end of the URL for the page.

What version are you using?

8.1.1

I have figured out the problem.
The parameter on the window was called “jobID” and the page configuration had the parameter as jobid.
Which was weird that it would load properly when the page originally opened but when you went back to the screen it wouldn’t work properly.

Well, that’s good. I was just typing that I had verified the correct behavior in 8.1.1, 8.1.5 and 8.1.8. That case-sensitivity is odd.

Good morning,

How would i add this to my session property? What would i add to it?

The session property approach requires that you perform the navigation via a Script Action to remove any potential race condition. This is how you would do it:

# note that 'somePage.param' are just keys and could be anything you want
self.session.custom.somePage.param = "myValue"
system.perspective.navigate(page="/path/to/page")

Then your page should refer to the session.custom.somePage.param property for whatever you were previously using the param for.

Is there a way to make this dynamic. I have many pages and in some cases it would be nice to go back page by page to navigate to another direction.

I assume when I add a custom prop to my session and then it will always navigate to that page identified in the custom prop value?

This post was written a very long time ago and users now have access to additional navigation functions (as of 8.1.5), like system.perspective.navigateBack. Check to see if that function serves your need.