How to make opera forget about a «position» part of the hyperlink just after it is followed? (This is useful when I want to reload page and keep position where I am reading, while the original link has its own position specified.)

Opera-10.52_pre6272, Gentoo


If you mean that you have followed a link with a fragment specified (the part after the hash sign), why not just press F5 to reload the page? Are you going to the address bar and pressing Enter or something?

  • If I used F5 I got positioned according to the fragment identifier. Now I don't. Was this was fixed in new opera? – ZyX Mar 31 '10 at 9:17
  • @ZyX: I don't know. I don't think I ever saw the behavior you describe. – Hugh Allen Mar 31 '10 at 11:10
  • Strange: on one site (unixforum.org, Russian forum about linux) I do not get positioned after reload. On other site (habrahabr.ru, Russian IT blog) I do get positioned after reload. So I still want to know how to make Opera forget about a fragment identifier. – ZyX Mar 31 '10 at 15:48
  • Update: on unixforum I also get positioned on reload, but not if I use link with post number. I used it now only because it was the fastest way to check your answer, so I never noticed such strange behavior. – ZyX Mar 31 '10 at 15:53
  • Another update: forget about strange behavior, the problem was that I do not get positioned only if I scroll not enough to make the target element invisible. – ZyX Mar 31 '10 at 15:56

I just tried again and Opera did as you said - when I reloaded, it went to the fragment ID in the URL. I don't know why I didn't notice it before - perhaps because it's a recent change and I don't often refresh a page I'm in the middle of reading. I would consider it to be a bug - perhaps you would like to report it to Opera Software? I can confirm the same behavior on the Windows version (10.51).

Anyway, here's a workaround: when I'm about to change zoom, which sometimes makes me lose my place, I select some text (preferably a few words from within a single paragraph) and copy it to the clipboard. Then after changing zoom (or in your case reloading), I search for the text I just copied (Ctrl+F).


This UserJS solves the issue:

// ==UserScript==
// @name PurgeAnchor
// @include *
// ==/UserScript==
(function() {
 var reg=/^(.*)\#(.*)$/;
 var match=reg.exec(location);
 function ObjectPosition(obj) {
    var curtop = 0;
          curtop += obj.offsetTop;
          obj = obj.offsetParent;
    else if(obj.y)
        curtop += obj.y;
    return curtop;
 if(match) {
    sessionStorage.setItem("anchor", match[2]);
 window.addEventListener("load", (function() {
         var anchor=sessionStorage.getItem("anchor");
         if(anchor!==null) {
             var obj=document.getElementById(anchor);
             if(obj===null) {
             var pos=0;
             if(obj!==null) {
                 window.scrollTo(0, pos);
     }), false);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.