Page loads twice – but with a twist
-
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
- The topic ‘Page loads twice – but with a twist’ is closed to new replies.