Magento 1.9 – How to Get Current URL

magento-1.9url

I want to get Current URL in Magento 1, using observer function, that observer triggered on the AJAX controller action.

In the observer function, I tried like :-

$currentUrl = Mage::helper('core/url')->getCurrentUrl();
it returns the controller action which wee used to call in AJAX, where us I need to get the Current active URL from the browser.

Can anyone help me with this?

Best Answer

change

$currentUrl = Mage::helper('core/url')->getCurrentUrl();

to

$currentUrl = Mage::app()->getRequest()->getServer('HTTP_REFERER');
Related Topic