13

I have developed a website where the "back" button does not always go back to the previous page when using IE - no issue with Firefox or Chrome. It seems that for certain page changes, IE cannot initially display the page, and then successfully loads it, but the initial failure appears in history.

Then when you hit "back" it first goes back to the error entry (though nothing changes on screen) and then a second hit of the button takes you back a page.

Cannot display webpage

I don't see the same behaviour on firefox, and I am not doing any redirects in the page transitions, and the only .htaccess rule I have is for FURL, which is a direct re-write, no redirects:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

Can anyone suggest an approach to finding out what IE didn't like on the page, that would cause this to happen?

The same behaviour is happening in IE7 and IE9.

Update: I think I have isolated this to linkedin plugins. These are used throughout the site. Pages that do not have any plugins work as expected, nothing weird in history. On some pages I have the "Follow Us" plugin:

<script src="//platform.linkedin.com/in.js" type="text/javascript"></script>
<script type="IN/FollowCompany" data-id="568783" data-counter="none"></script>

And these have a single "Cannot Display Page" in the history once you go to the page. On another page, I have 6 plugins called, to populate a team page with 5 profiles from linkedin, and a Follow Us plugin. Each call to linkedin results in a "cannot display this page" in the history:

enter image description here

Any ideas why this would happen?

Paul
  • 538
  • 6
  • 23
  • At a guess i would say that the linkedin plugin is loading each of your teams pages in an iframe added dynamically and internet explorer is probably not showing the titles as the iframe comes from a different source to your website. As to why exactly these show up or how to fix it... – Daniel Powell Aug 27 '12 at 05:42
  • 1
    https://developer.linkedin.com/forum/plugins-back-button-breaks-ie looks like its been there for a while – Daniel Powell Aug 27 '12 at 05:44
  • @DanielPowell Thanks Daniel, no idea why I couldn't find that before. I'll post an answer if they come up with one. – Paul Aug 27 '12 at 06:24
  • took a fair bit of google-fu to find that so thats probably why! – Daniel Powell Aug 27 '12 at 22:39
  • @DanielPowell Yeah, which is strange, given the prevalence of IE and LinkedIn plugins, this should be an issue affecting a huge number of sites. As the complaints are few, I am wondering if there is something specific about my approach. – Paul Aug 27 '12 at 23:15
  • I have found a few others using the plugin, and the same issue occurs. My guess is that people are simply not noticing. – Paul Aug 28 '12 at 00:23
  • what if you loaded all of the linkedin stuff inside its own iframe again? – Daniel Powell Aug 28 '12 at 00:54
  • @DanielPowell Yeah I was considering that. When I look at the code I see that it is already two iframes deep already. I was thinking of going the other way and ditching the script, and loading the iframe myself, straight to the lowest level. This will work for profiles by the look of it, but maybe not the follow badge. – Paul Aug 28 '12 at 02:13

1 Answers1

3

This answer doesn't address what is happening, but I'll leave it here until the real answer is uncovered (this issue will probably need to be fixed by LinkedIn themselves).

LinkedIn like you to use their plugins to pull in content, however they cause this issue by a weird redirect and the error appearing in the history, breaking the back button. The javascript inserts two levels of iframe into the page, however you can just get the second level frame and put this directly into your html. This has the benefit of being much faster, and has the downside of needing to be maintained in case anything changes in the backend at LinkedIn.

For example, this iframe will pull in the Follow Us plugin for a specific company:

<iframe id="easyXDM_IN_Lib_li_gen_1346300675316_0_provider" frameborder="0"
  src="http://www.linkedin.com/cws/followcompany?companyIdentifier=568783&counterPosition=none&original_referer=http%3A%2F%2Fwww.marshallmcadam.com.au%2Four-team.html&token=&isFramed=false&lang=en_US&_ts=1346111060041.3884" 
  style="width: 83px; height: 20px; display: inline-block;"
  name="easyXDM_IN_Lib_li_gen_1346300675316_0_provider">
</iframe>

This is the important part:

src="http://www.linkedin.com/cws/followcompany?companyIdentifier=568783"

The identifier should match the one you want to offer a follow button for. The remainder of the options were lifted directly from the generated iframe code, so it is mostly unnecessary.

Paul
  • 538
  • 6
  • 23