Title: Document referrer
Last modified: November 8, 2018

---

# Document referrer

 *  [eagardiner](https://wordpress.org/support/users/eagardiner/)
 * (@eagardiner)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/document-referrer/)
 * Hello, I am using AWS for my site and would like to change the formatting of 
   certain pages depending on the internal referrer page. I have tried document.
   referrer inside ajaxComplete() but it is empty and $_SERVER[‘HTTP_REFERER’] but
   it gives the URL of the current page not the previous page. Does anyone have 
   a suggestion for how I might achieve this please? Many thanks.
    -  This topic was modified 7 years, 7 months ago by [eagardiner](https://wordpress.org/support/users/eagardiner/).

Viewing 1 replies (of 1 total)

 *  [davewoodhall](https://wordpress.org/support/users/davewoodhall/)
 * (@davewoodhall)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/document-referrer/#post-10859853)
 * I don’t know how comfortable you are with JavaScript, but I would do something
   like this.
 *  jQuery(document).ready(function(){
    // use a custom var as tracker var previousPage
   = “”;
 *  jQuery.ajax({
    cback:function(d){ console.log(d); // get info in “d” and work
   with the value of previousPage; } }); });
 * I don’t have the exact variable names but I believe somewhere in there you will
   have more information. Otherwise, you can use plain javascript to get the window.
   location to update said variable and work from there.
 * Hope this helps!

Viewing 1 replies (of 1 total)

The topic ‘Document referrer’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/ajaxify-wordpress-site.svg)
 * [Ajaxify Wordpress Site(AWS)](https://wordpress.org/plugins/ajaxify-wordpress-site/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ajaxify-wordpress-site/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ajaxify-wordpress-site/)
 * [Active Topics](https://wordpress.org/support/plugin/ajaxify-wordpress-site/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ajaxify-wordpress-site/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ajaxify-wordpress-site/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [davewoodhall](https://wordpress.org/support/users/davewoodhall/)
 * Last activity: [7 years, 7 months ago](https://wordpress.org/support/topic/document-referrer/#post-10859853)
 * Status: not resolved