'How can i get previous page url in Kentico 12 PE?

How can i get previous page url in Kentico 12 PE? Visitor.GetUrlReferrer() macro and document.referrer js are always empty.

I want to change my webpart variant via url of previous page. image1



Solution 1:[1]

No need to use Kentico macros when you can use plain JavaScript.

window.history.previous.href

How to get the previous URL in JavaScript?

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Brenden Kehren