Bug 29466 - [Qt] [Webkit] Using backslash escaping breaks links.
Summary: [Qt] [Webkit] Using backslash escaping breaks links.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Page Loading (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other OS X 10.5
: P2 Minor
Assignee: Nobody
URL:
Keywords: Qt
Depends on:
Blocks:
 
Reported: 2009-09-18 08:24 PDT by Tor Arne Vestbø
Modified: 2010-01-14 10:50 PST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tor Arne Vestbø 2009-09-18 08:24:20 PDT
This bug report originated from issue QTBUG-2479
<http://bugreports.qt.nokia.com/browse/QTBUG-2479>

--- Description ---

When using the following link to a local HMTL file and clicking a link to another local file, the new page doesn’t load.

For example: “c:\\pages\\index.html” is written in the address bar in the Qt browser demo. The page loads but when a link inside is pressed; the new page is not loaded properly. 

With “c:/pages/index.html” everything works perfect.


On Tue Jul 22 13:56:37 2008 qtsupport wrote:

- How to reproduce:
1. Start the demo browser in Qt 4.4
2. Copy the files from task 220074 to a directory(i.e. c:/pages)
3. Load the page typing “c:\\pages\\index.html” in the address bar.
4. Click on the link

- Expected result:
New page should load.
- Actual result:
A blank page 

Contents:

Or use this code(four files):

Testlinkclicked.h

class testLinkClicked : public QObject
{
 Q_OBJECT

 public:
  testLinkClicked() {};
  testLinkClicked( QWebView* w ){
   connect( w, SIGNAL( linkClicked ( const QUrl & ) ), 
    this, SLOT( showLinkClicked() ) );
  }
 
 public slots:
  void showLinkClicked(){
   qDebug("Link has been clicked!");
  }
};

qtest.cpp


int main(int argc, char **argv){
 QApplication qapp(argc,argv);
 QWebView* view = new QWebView();
 /*
  * uncomment these lines to see if link is clicked
  */
// view->page()->setLinkDelegationPolicy( QWebPage::DelegateAllLinks );
// testLinkClicked test( view );

 /*
  * works: absolute path with forward slashes
  */
 QString l_urlString = QDir::currentPath() + "/index.html";

 /*
  * does not work: the slash before the html file is a backslash!
  *
  * effect: link acts as being clicked (changes color) but index.html stays the current page
  */
// QString l_urlString = QDir::currentPath() + "\\index.html";

 /*
  * does not work: all slashes are backslash
  *
  * effect: blank page is shown
  */
// QString l_urlString = QDir::currentPath().replace('/', "\\") + "\\index.html";

 qDebug( "%s", qPrintable( l_urlString ) );
 QUrl l_url( l_urlString );
 view->setUrl( l_url );
 view->show();

 qapp.exec();
}

Index.html

<html><head><title>This is page 1</title></head><body><h1>this is page 1 (index.html)</h1>Click here to go to <a href="page2.html">page2</a></body></html>

Page2.html

<html><head><title>This is page 2</title></head><body><h1>This is page 2</h1></body></html>
Comment 1 Jocelyn Turcotte 2010-01-14 10:50:51 PST
Fixed in 4.6.0