-20

There is a bug in SO posts that suppose I am reading a SO post which also contain a link to other website and then after I upvoted/downvoted it and then when I click on that link and go back from my browser then it show me the post not upvoted/downvoted. So because of which I click again on upvote/downvote which is very annoying.

Can you guys please change this behaviour I have faced this issue several times.

36
  • 9
    Show me ANY website where you can do an update, leave the page, go back (with a brower "back", not revisit the page ofc), and see your change..... this is just.... not how caching and browsers work.....
    – Patrice
    Commented Oct 11, 2017 at 19:11
  • 4
    Visited links are handled differently by the browser, which has nothing to do with the page loading or the scripts therein.
    – user4639281
    Commented Oct 11, 2017 at 19:41
  • 7
    @SudhanshuGaur Because the SO team cannot control what browsers do. They're developed by entirely separate teams of people. Commented Oct 11, 2017 at 19:45
  • 7
    @SudhanshuGaur If you want to write your own browser that always reloads pages when using the back button, more power to you. SO is in the business of making QA sites, not building browsers, and so isn't going to make their own browser with different functionality than whatever your browser does to fix this for you.
    – Servy
    Commented Oct 11, 2017 at 19:46
  • 8
    Your up or down vote is posted as an ajax request. Your vote never becomes part of the document as stored in the history of your browser. Your votes are not fetched when the page is served from the browser cache. To see your votes you have to do a reload so the server can serve you a page that has your vote in it. To resolve this minor issue a lot of dev time / re-design is needed and possible performance will be lost.
    – rene
    Commented Oct 11, 2017 at 19:54
  • 2
    You already asked once in the comments. Just be patient and wait, don't vandalise your question.
    – cs95
    Commented Oct 11, 2017 at 20:05
  • 2
    Google - and other sites - remember which links you've clicked on because those links are stored in your internet history. If it sees a page in your recent history that matches the link it colors it in. However your voting information is not kept in your browsing history, so the browser has no way of knowing the action has taken place, and renders the page as it was last loaded; without any votes. Commented Oct 11, 2017 at 20:10
  • 4
    No, that would be immensely complex, you need to keep track which questions you visited, what their vote state was, then onload determine which value is true, the server one, or the localstorage one. Now bring in that you can undo your vote in a second tab or even in another browser. Or from your phone, or from your work pc. And then you navigate back to a page from 3 weeks ago. What do you expect to happen? I would personally just want to reload the frigging page from the server so that I know I'm looking at up to date and valid for all data.
    – rene
    Commented Oct 11, 2017 at 20:20
  • 3
    you mention "your answer", but you don't have an answer. You have - at best - a vague idea of an end-goal, but no plausible means to get there, or for dealing with anything but the most absolutely straightforward of cases. Maybe this would be better received if you had a specific idea of how this is to be accomplished, but as it stands you're asking SO to put in a ton of work essentially rewriting incoming browser's caching functionality for what is at best marginal improvement to the end-user, as they can just reload the page for the same result. Commented Oct 11, 2017 at 20:39
  • 3
    I've been using the site for 7 years now and cast some 23,000 votes. I've run into this from time to time but somehow it's not been a problem, ever, not even a single time. If you care about the vote count then reload the page. Problem solved. No?
    – Pekka
    Commented Oct 11, 2017 at 20:39
  • 3
    If your scenario is also only half a fix then let just keep the status quo and do nothing. The only thing that could work is make an extra roundtrip to the server on pageloadComplete, either via an ajax call or a websocket to fetch the actual voting state. But as I said earlier, Nick is going to hate you for the extra connections/network/server load that will cost. And if the solution is going to comprise average pagespeed for everyone you can forget it. It will be a status-declined
    – rene
    Commented Oct 11, 2017 at 20:40
  • 3
    No, you are NOT pushing an update to Google. I may have been unclear. But the "link has been visited by you" isn't kept by Google, but by your browser. That's the difference here.
    – Patrice
    Commented Oct 11, 2017 at 21:22
  • 3
    Sorry... what? The visited link functionality (i.e. your browser highlighting links that you have visited) is entirely on the browser end. That has absolutely nothing to do with the website the links are contained on. Similarly, if you click on a link here, then press the back button, that link will be marked as visited and highlighted as such. This happens no matter where you are on the web because it is controlled by the browser, and has absolutely nothing to do with the site you're viewing.
    – user4639281
    Commented Oct 11, 2017 at 21:24
  • 4
    It is possible using CSS to disable visited link highlighting. Facebook may be doing that. That has nothing to do with refreshing the page on press of the back button. They would only be changing the color of the visited links to that of normal links. I don't ever use or visit Facebook, so I don't know what for sure they are doing.
    – user4639281
    Commented Oct 11, 2017 at 21:27
  • 5
    And even if you would rely on the :visited state of a link and use that on the votes button, there is no way to unvisit a link, so if you undo your vote it would still remain visited.
    – rene
    Commented Oct 11, 2017 at 21:53

1 Answer 1

20

This is just how browsers work. SO has no say in this. Your browser is re-building the page based on its own memory of what the page was like the last time it loaded it, rather than fetching it from SO again.

2
  • Can you please have a relook at my question. Thanks for answering here. Commented Oct 11, 2017 at 19:39
  • 2
    Yet, it is possible to run some custom code when a page is revisited. See history API and my other, slightly more elaborate, comment. Commented Oct 12, 2017 at 10:55

Not the answer you're looking for? Browse other questions tagged .