Search code examples
javascripthtmloperaopera-minimobile-browser

Why does Opera Mini sometimes click the wrong link


Every once in a while, but especially prevalent on Facebook, Opera Mini will exhibit the following behavior. Of two successive and different links, seperated by text and other markup:

  1. the correct link will highlight on hover,
  2. when clicked, no other flashing/highlighting occurs, but
  3. it loads the second (incorrect) link, or some other link altogether.

In a related but not identical question1, it was suggested that it's either the same link, the same bound javascript event, or an unclosed a tag. I am almost entirely sure it's not the first or last, but may be the js issue if it's nothing else. But, as I can't test in this environment, I'm asking the community, which maybe has experience here. Thanks!

1Oddly enough, this bug/issue cropped up while navigating suggested answers for this question (after clicking on listed question and hitting 'back', on clicking the second possible listed question, it returned me to the question page without any suggested links showing). I can't go back to check without losing this page, though, so will have to try to search out the question and link it here later.


Solution

  • I don't use Facebook but I did get the same thing as you when trying to ask a Stackoverflow question and clicking on related links. The links are generated dynamically by pulling in an external list of search results. For example: https://stackoverflow.com/search/titles?like=why+does+opera+mini+sometimes+click+the+wrong+link

    As you probably know, Opera Mini renders JavaScript on the server. When the "ask a question" page loads the related links script is executed but when you go back to the same page, the script doesn't execute a second time. Only the cached page is displayed which can affect dynamically generated content and scripts.

    In addition, to avoid rogue scripts running for too long and potentially crashing the Opera Mini servers, scripts on a page are only run for a couple of seconds so any links generated after this time will not appear or behave as they should. Here's some more info about Opera Mini's JavaScript behaviour: http://dev.opera.com/articles/view/opera-mini-web-content-authoring-guidelines/#javascript