Conditional redirection with the browser component ignoring some conditions

I may be missing something obvious but i have a problem with browser redirects i cant seem to resolve. Before delving into custom php to solve this I thought I would ask here

I know is is simple to redirect conditionally with an expression like browser1.goto( [condition]?’‘page1.html’:‘page2.html’) within the success event.

In my case the server action returns a status code between 0 and 4

what i need is to ignore status codes 0-2 (i.e no redirect) but redirect to “page3.html” and ‘page4.html’ on status codes 3 or 4.

I am running out of ideas, everything i have tried either causes an error or redirects incorrectly

Anyone any ideas?

Hi Brian,
Please try:

browser1.goto( status == 3 ? 'page3.html' : status == 4 ? 'page4.html' : false)

Not sure about the ‘false’ part as I am on my phone currently.

Interesting. needed “F” of false capitalised i.e. “False” but it does work thanks

It does however leave an error in the developers console when the “False” is called i.e. stutus’ 0 - 2


Ok, sorry what if you try '' instead of 'false'
I will be able to check this but later, when I am on a computer.

That was my first idea, unfortunately that redirects to the website root

Maybe just change the condition logic, like:

status == 3 ? browser1.goto('page3.html') : status == 4 ? browser1.goto('page4.html') : false

Thanks Teodor, that has done it!