How to get the current url?

I want to full url of the current page.

For example:

I am passing some parameters and using operators I want to see if it matches the parameter or not.

I tried this but got an error: {% assign current_url = <script>document.write(window.location.href)</script> %}


you can’t do what you did above because you are mixing something that runs at build time (jekyll) with something running in real time (JS).

I think you need a full JS solution, ignore the jekyll aspect, so it looks like you are half way there.