Pricing Blog

is there a "go back to previous url" action in nordcrafT?

  • ssssadsadasd-1376795966086053949

    ssssadsadasd

    2 months ago

    I want to go back to previous url, and then back etc till the initial page. how can I do this in nordcraft?

    Thanks
  • plusmin-1376805658367754290

    Armand

    2 months ago

    If you use path parameters you can navigate back. If you use query parameters, then that is not the case.

    Reference: https://docs.nordcraft.com/pages/static-and-dynamic#when-to-use-url-parameters

    You can check your browser history to see when a new navigation entry has been added.
  • ssssadsadasd-1376810457238736997

    ssssadsadasd

    2 months ago

    @Armand thanks.
    if I use path parameters how can I go back?
  • plusmin-1376812063342465054

    Armand

    2 months ago

    With path parameters you create a new entry in your browser history, so you can go back by clicking the 'previous' or 'back' button in your browser.
    But perhaps your use case needs something else. What are you trying to achieve?
  • ssssadsadasd-1376813803697737839

    ssssadsadasd

    2 months ago

    I have a "back" button. and I want sth like when button is clicked go back
  • plusmin-1376816139140595782

    Armand

    2 months ago

    You could get the path via a custom action using the document.referrer property.

    Or if you have a single page application then you can store the path in session storage and call it with your button.
  • plusmin-1376816414488264735

    Armand

    2 months ago

    As far as I know there is no built in action in NC for this.
  • ssssadsadasd-1376816748871024701

    ssssadsadasd

    2 months ago

    yeah, that's what I wanted to know, how to implement this or whether there is an example
  • ssssadsadasd-1376830337883181126

    ssssadsadasd

    2 months ago

    @Armand many thanks, but my case is a bit different.
    I would not want the page to refresh when I only changed path parameters. the go to url I guess always refreshes the page

    is this possible in nordcraft?
  • plusmin-1376830667744215040

    Armand

    2 months ago

    Ah, so you are using query parameters? Then you can just store the navigation history in a variable (in an array).
  • ssssadsadasd-1376831090798493696

    ssssadsadasd

    2 months ago

    that was my initial idea, but when the user simply scrolls left (goes back without clicking anything) how should I know whether the user did that?
  • I could do on attribute change but that does not differentiate between a user clicking sth or scrolling back (when the two queries are the same)
  • plusmin-1376831872943919196

    Armand

    2 months ago

    I would have to see it in the editor to understand it properly
  • plusmin-1376835032387420270

    Armand

    2 months ago

    Can you share a link to your project or similar project?
  • ssssadsadasd-1376840859173130291

    ssssadsadasd

    2 months ago

    [here ](https://editor.nordcraft.com/projects/moccasin_palpatine_chief_rook/branches/start/components/test2323?canvas-height=800&canvas-width=800&mode=design&rightpanel=events) is an example.

    I go back and forward clicking the buttons. but when the user simply clicks scrolls left (i.e. goes to the previous history item without clicking) how am I supposed to record this in the variable list of path parameters?

    hope I was clear enough
  • ssssadsadasd-1376843240023527494

    ssssadsadasd

    2 months ago

    probably I could just use the formula you sent me and infer the parameters from that
  • plusmin-1376843257409175612

    Armand

    2 months ago

    when you say scroll left, do you mean when they are on mobile and they swipe left to go back?
  • ssssadsadasd-1376844014740832317

    ssssadsadasd

    2 months ago

    yeah, I mean even in desktop when you go left with the mouse. dont know whether it is exactly a scrolling 😅
  • plusmin-1376844638815649914

    Armand

    2 months ago

    Ok, got it. Well, the path changes. Something like this could work:
    1. Attribute change
    2. Workflow with switch which checks if current url is same as previous from your array of paths.
    3. If yes, remove it from your array
    👍1
  • nocodeprocode-1377281638307729468

    NoCode ProCode

    2 months ago

    If you change the URla nd have data bound to that change and you use "push" when updating the path it counts as a page redirects and have the native swiping - but it's not beneficial for SPAs.
  • ssssadsadasd-1382021784936910990

    ssssadsadasd

    1 month ago

    @Andreas Møller is there any possibility to have an action "go to previous url" which goes to the previous url (without refreshing if the page is the same) (bubble has it)? same as simply clickng left icon in the browser

    having to save urls in a variable is both annoying and it does not work always
  • andreasmoller-1382040540069101608

    Andreas Møller

    1 month ago

    Left arrow does refresh the browser
  • ssssadsadasd-1382075155727122562

    ssssadsadasd

    1 month ago

    @Andreas Møller I dont think it does if only the attributes are changed. just checked in my NC app
  • andreasmoller-1382075518568108152

    Andreas Møller

    1 month ago

    Most browsers has something called a "back-forward" cache which means it caches pages when navigating away from them.
  • It wont do a full server load, but it is not that same instance of the page as before
  • That might be exactly what you want ( it is in most cases) bit it is something to be aware of
  • ssssadsadasd-1382076244106936320

    ssssadsadasd

    1 month ago

    not sure I understood everything you said but yeah it is what I would want. go back action that sends you back to the previous url and at the same scroll position.
    is this sth you might implement in the future?
  • ssssadsadasd-1389994516655636521

    ssssadsadasd

    28 days ago

    @Andreas Møller is this sth that you will include in the future? i.e. a "go back to previous url" action (right now you have to save in a variable and it just is so difficult to maintain).
    thanks
  • andreasmoller-1390031647293964289

    Andreas Møller

    28 days ago

    Yes definitely
    👍1