diff --git a/demos/declarative/webbrowser/content/FlickableWebView.qml b/demos/declarative/webbrowser/content/FlickableWebView.qml
index fb479d2..1f337ea 100644
--- a/demos/declarative/webbrowser/content/FlickableWebView.qml
+++ b/demos/declarative/webbrowser/content/FlickableWebView.qml
@@ -120,10 +120,38 @@ Flickable {
         }
         onUrlChanged: {
             // got to topleft
-            flickable.contentX = 0
-            flickable.contentY = 0
+            if (!anchorAnimation.running) {
+                flickable.contentX = 0
+                flickable.contentY = 0
+            }
             if (url != null) { header.editUrl = url.toString(); }
         }
+        onAnchorLinkClicked: {
+            anchorAnimation.toX = Math.max(Math.min((geometry.x-5)*contentsScale, flickable.contentWidth-flickable.width),0);
+            anchorAnimation.toY = Math.min(geometry.y*contentsScale, flickable.contentHeight-flickable.height);
+            anchorAnimation.running = true;
+        }
+        ParallelAnimation {
+            id: anchorAnimation
+            property alias toX: xanim.to
+            property alias toY: yanim.to
+            NumberAnimation {
+                id: yanim
+                target: flickable
+                property: "contentY"
+                to: 0
+                duration: 500
+                easing.type: Easing.InOutQuad
+            }
+            NumberAnimation {
+                id: xanim
+                target: flickable
+                property: "contentX"
+                to: 0
+                duration: 500
+                easing.type: Easing.InOutQuad
+            }
+        }
         onDoubleClick: {
                         if (!heuristicZoom(clickX,clickY,2.5)) {
                             var zf = flickable.width / contentsSize.width
diff --git a/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp b/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp
index 94f08bd..a5e8445 100644
--- a/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp
@@ -70,6 +70,31 @@ public:
     QDeclarativeComponent* newWindowComponent;
     QDeclarativeItem* newWindowParent;
 
+    QWebElement findAnchor(const QString &anchor)
+    {
+        return findAnchor(view->page()->mainFrame()->documentElement(), anchor);
+    }
+
+    QWebElement findAnchor(QWebElement element, const QString &anchor)
+    {
+        QWebElement child = element.firstChild();
+        while (!child.isNull()) {
+            if (child.attribute(QLatin1String("id")) == anchor) {
+                return child;
+            } else if (child.tagName() == QLatin1String("A")) {
+                if (child.attribute(QLatin1String("name")) == anchor)
+                    return child;
+            }
+
+            QWebElement e = findAnchor(child, anchor);
+            if (!e.isNull())
+                return e;
+            child = child.nextSibling();
+        }
+
+        return QWebElement();
+    }
+
     static void windowObjectsAppend(QDeclarativeListProperty<QObject>* prop, QObject* o)
     {
         static_cast<QDeclarativeWebViewPrivate*>(prop->data)->windowObjects.append(o);
@@ -328,6 +353,11 @@ void QDeclarativeWebView::pageUrlChanged()
     if ((d->url.isEmpty() && page()->mainFrame()->url() != QUrl(QLatin1String("about:blank")))
         || (d->url != page()->mainFrame()->url() && !page()->mainFrame()->url().isEmpty()))
     {
+        if (d->url.toEncoded(QUrl::RemoveFragment) == page()->mainFrame()->url().toEncoded(QUrl::RemoveFragment)) {
+            QWebElement anchorElement = d->findAnchor(page()->mainFrame()->url().fragment());
+            if (!anchorElement.isNull())
+                emit anchorLinkClicked(anchorElement.geometry());
+        }
         d->url = page()->mainFrame()->url();
         if (d->url == QUrl(QLatin1String("about:blank")))
             d->url = QUrl();
diff --git a/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview_p.h b/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview_p.h
index b2055bf..7537c3f 100644
--- a/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview_p.h
+++ b/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview_p.h
@@ -213,6 +213,7 @@ Q_SIGNALS:
     void loadFailed();
 
     void doubleClick(int clickX, int clickY);
+    void anchorLinkClicked(const QRectF &geometry);
 
     void zoomTo(qreal zoom, int centerX, int centerY);
 
