Home > database >  Capturing the url view
Capturing the url view

Time:09-15

On javascript how would you go about keeping a selected navbar? I have been able to achieve this using sessionStorage but the issue is, if the user navigates the site directly on the url, then it wont register and the site thinks the user is still on another view. Is there any way to capture the place on the url the user is instead of capturing the navbar element he clicked?

CodePudding user response:

You can use the window.location object, it provides good amount of information about the url that was loaded. More info here: https://developer.mozilla.org/en-US/docs/Web/API/Window/location

  • Related