开发者

get title and url of the previous page on Magento

I'm trying to get title and url of the previous page the customers visited in Magento. We can get the URL via $ _SERVER ['HTTP_REFERER'] variable but not sure how to get it's title. Would appreciate any help on this issue or maybe different approaches how to开发者_如何学Go display the previous page (url + title) in Magento


This information isn't sent normally, so you may want to add an observer to the page that saves the last title in the session. The trick will be that this will save the last page from /any/ tab, not necessarily for the referring page. You could save all titles from pages this way, but you'd have to hold onto everything (they could click the link a second time consecutively, etc etc). This may also run into issues with full page caching.


I know this is old but fyi you can JavaScript to the page and use

alert(document.referrer);

Since the numbers of web users with JavaScript turned on (~98%) and most site requirements it's safe. You would be able to make all adjustments to the DOM with that. Just one way of getting what you need.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜