Version: 0.4.0 (using KDE 4.4.2) OS: Linux Installed from: Gentoo Packages When viewing the source text of a web page, rekonq does not show what the server delivered but a changed version. I tried it a page from one of my homepages (http://dr-leupold.de/vita.php); Konqueror, Firefox and Opera all show exactly the very same page source (with only the DC.date meta tag of the header differing for obvious reasons) which is identical with the HTML the PHP script generates. In contrast, rekonq changes all kind of stuff when viewing the page source: All over the text, newlines are added or left out The <?xml tag is left out The <!DOCTYPE tag is displayed in one line, the <header> tag is appended All the necessary closing slashes (like for <meta ... /> or <img ... />) are left out A <tbody> tag is inserted in the table I really think rekonq should display the actual source text instead of a changed version!
I can confirm this behaviour. In Konqueror with the kdewebkit KPart it shows the same source as the KHTML one, so this most likely is a rekonq specific issue. Thanks for the report
The solution is always to use KRun::runUrl() to re-fetch the file from the server and display it, since WebKit apparently generates its source rather than keeping what it originally received. But this introduces issues of double loading, with regard to bandwidth. The alternative would be to set the link delegation policy for webkit to do nothing, manually load the URL using KIO and use setHtml(). Perhaps then the file could be cached. But which choice to make?
I'm not a rekonq coder, but I would cache the original source file if Webkit changes the original source, as the source could have already changed when the user requests it. Just think of the DC.date header of my homepage.
commit face04758de427df55b58ce47d0a39628b6b96fa Author: Andrea Diamantini <adjam7@gmail.com> Date: Tue May 25 01:38:37 2010 +0200 Show actual page source BUG:235338 diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index d14f225..1b36e6d 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -951,26 +951,8 @@ void MainWindow::viewPageSource() if (!currentTab()) return; - KUrl url(currentTab()->url()); - bool isTempFile = false; - if (!url.isLocalFile()) - { - KTemporaryFile sourceFile; - - /// TODO: autochoose tempfile suffix - sourceFile.setSuffix(QString(".html")); - sourceFile.setAutoRemove(false); - - if (sourceFile.open()) - { - sourceFile.write(currentTab()->page()->mainFrame()->toHtml().toUtf8()); - - url = KUrl(); - url.setPath(sourceFile.fileName()); - isTempFile = true; - } - } - KRun::runUrl(url, QL1S("text/plain"), this, isTempFile); + KUrl url = currentTab()->url(); + KRun::runUrl(url, QL1S("text/plain"), this, false); } diff --git a/src/urlbar/urlresolver.cpp b/src/urlbar/urlresolver.cpp index c2f1d0e..07b40ba 100644 --- a/src/urlbar/urlresolver.cpp +++ b/src/urlbar/urlresolver.cpp @@ -271,4 +271,3 @@ UrlSearchItem UrlResolver::privilegedItem(UrlSearchList* list) } return UrlSearchItem(); } -