• We build dynamic real estate pages. We’ve noticed that for each single request to generate a page for any given url, our plugin goes through it’s initialization twice. The difference appears to be $_SERVER[‘HTTP_ACCEPT’]. On the first time through, HTTP_ACCEPT contains what you would expect -> “text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8”

    But on the second time through, it only contains “image/webp,*/*;q=0.8”. Like it’s looking for a favicon or something.

    The plugin loads like this:

    add_action('plugins_loaded', array(self::instance(), '_setup'));

    public static function _setup ()
    	{
    	global $rover_idx;
    	$rover_idx					= new Rover_IDX;
    
    	if ((strpos(strtolower($_SERVER['HTTP_ACCEPT']), 'text/html') !== false))
    		{
    		require_once ROVER_IDX_PLUGIN_PATH.'rover-init.php';
    		require_once ROVER_IDX_PLUGIN_PATH.'rover-content.php';
    		}
    	}

    So we made a change (above)to exit the initilization if HTTP_ACCEPT did not contain ‘text/html’. This worked great, until we realized that the Next / Prev browser buttons didn’t like it. If you pressed the Prev button, you’d see the previous page, but the [rover_idx…] shortcode would not be translated into content – you’d just see the shortcode on the page.

    To reproduce:
    – First go to https://vail.demo.roveridx.com/.
    – Then go to https://vail.demo.roveridx.com/co/vail/.
    – Then hit the back button.

    I *think* this should be moved into the Advanced forum section.

    Thanks
    Steve

Viewing 1 replies (of 1 total)
  • Thread Starter shawmutsteve

    (@shawmutsteve)

    I’ve been doing more investigation into this, as I have time. One curious thing I notice is that there are error_log statements in a few places, so I can see a log file created when a page is requested.

    But I don’t see any log file created when the back button is pressed.

    So you might assume that the back button is depending entirely on the browser cache. But that doesn’t really make sense, because when you press the back button, you see a different version of the previous page – the shortcode on the page was not executed, so you see the shortcode itself printed on the page. So if we’re seeing this page with the shortcode printed – why is there no error log?

Viewing 1 replies (of 1 total)
  • The topic ‘Page loads twice – but with a twist’ is closed to new replies.