[Qt-interest] Anchors in QWebView url
Eric Clark
eclark at ara.com
Wed Jan 20 17:37:35 CET 2010
Hello All,
I have an application that uses its own special type of URL and scheme. Obviously QWebView does not understand the URL, but I handle it quite well when navigating between pages in the application. However, in order to get the view to properly display images and other objects with relative paths in the HTML, I have to set the base url to some random file on the system. This works great! However, when I try to use an anchor in a link, the QWebView thinks that it needs to move the anchor relative to the base URL and it does not take me to the appropriate anchor in the document. Basically, I have a URL that looks like this:
cm-help://project/somelocation/someotherlocation
And I will set the base URL to something like:
file:///somedirectory/somefile.txt<file:///\\somedirectory\somefile.txt>
Where "somedirectory" is the base directory for locating relative links for images and other objects in the HTML document. But, some of the links in the HTML document refer to an anchor in the current document like so:
<a href="#someanchor">Click Here</a>
And there is an anchor in the document like so:
<a name="someanchor">
When the link is clicked on, QWebView tries to go to: file:///somedirectory/somefile.txt#someanchor<file:///\\somedirectory\somefile.txt#someanchor> instead of navigating to the anchor in the document that is being viewed in the QWebView.
Does anyone know of a way to handle anchors, so that the links go to an anchor in the document that is being viewed and not the base URL?
Any help would be greatly appreciated!
Thanks,
Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100120/d23149f3/attachment.html
More information about the Qt-interest-old
mailing list