كيفية الاستماع إلى التغيير في معلمات البحث في عنوان URL أثناء التنقل إلى مسار مختلف

Is there any way to listen change in search params while changing the url inside the widget.

Example:
?search=abc

When I console log the “location.search” it’s empty. However when I refresh the page or click on any other action it console “?search=abc”

I want to trigger action if there is search params in url.