urlReferrer and opening new browser tab
To open particular URL in a new tab, you have at least two possibilities:
- click a link with middle button (usually under mouse wheel) or
- open a blank tab and copy-paste URL to URL bar.
There is slight difference it this (at least in Chrome) when it comes to
urlReferrer in Yii:
- in first case browser sets referrer correctly (i.e.
Yii::app()->request->uUrlReferrercontains a valid URL),
- in second approach URL referrer IS NOT set (i.e.
Yii::app()->request->urlReferreris an empty string).
The second situation is obvious. Opening a new tab means that browser does not have a history for it and thus it is unable to set
urlReferrer correctly. However, it is better to keep this information in mind. If you rely on this information, you may get yourself (or your code) into a problem.