Javascript:history.back(), but on a condition

I’ve read the threads on using this, and in fact have it working on a Button using this:

<a href="#" dmx-bind:href="javascript:history.back()" class="btn btn-primary mb-4">Back</a>

And we know we can use a condition on a dmx-on:click
For example:
dmx-on:click="browser1.viewport.width > 576 ? (selected_index.setValue(ID) + : (selected_index.setValue(ID) + +"
(this works fine, btw)

So I need to modify my button (or any other clickable item, doesn’t have to be this button) to check a variable and either:
javascript:history.back() -OR- goto a specific page/URL

Spent 30 minutes and can’t figure it out. I was trying to do a condition in the bind:href statement, but the condition kept getting a syntax error at the “:” . I just think a condition doesn’t work on dmx-bind:href
Any ideas?

Community Page
Last updated: