Active Topics

 


Reply
Thread Tools
helex's Avatar
Posts: 543 | Thanked: 802 times | Joined on Apr 2010 @ Germany
#1
Hi!

twitter has updated their mobile website "app" for Android and iOS. We are able to use this "app" at our N9/50, too. We simply have to load the mobile twitter page at the build in webbrowser. Have a look at the second screenshot below.

Sadly the screen is not very well used and I would prefer to hide the adress and the status bar on top of the page.

So I thought I could create simly my own browser using Qt and qml:

Code:
import QtQuick 1.1
import com.nokia.meego 1.0
import QtWebKit 1.0

Page {
    Flickable {
        id: flickable
        width: parent.width
        height: parent.height
        contentWidth: Math.max(parent.width,webView.width)
        contentHeight: Math.max(parent.height,webView.height)

        WebView {
            url: "http://mobile.twitter.com"
            id: webView

            preferredWidth: flickable.width
            preferredHeight: flickable.height

            settings.javaEnabled: true
            settings.javascriptCanAccessClipboard: true
            settings.javascriptCanOpenWindows: true
            settings.javascriptEnabled: true
            settings.pluginsEnabled: true
            settings.localStorageDatabaseEnabled: true
            settings.localContentCanAccessRemoteUrls: true
            settings.offlineStorageDatabaseEnabled: true
            settings.offlineWebApplicationCacheEnabled: true
        }
    }
}
Sadly I got a very old and limited mobile webpage instead of the new mobile application as you are able to see in the other screenshot. The build in webbrowser seems to use a different engine and not QtWebKit... or have I to change somehow the user agent (haven't found how to do it) or activate some scripting capability?

Has anyone a idea?

Am I able to use the engine of the build in browser instead of QtWebKit?
Attached Images
  
__________________
I was a Qt Ambassador!

Please DONATE if you like my work!
It's the best way to motivate me to create more stuff for your Device.
 
Posts: 1,048 | Thanked: 979 times | Joined on Mar 2008 @ SF Bay Area
#2
Based entirely on what I've read at various places and tried out on the n950 and n9:
1. The default browser uses Webkit 2.
2. I've not yet found a way to change the UA of the default browser
3. QML uses Webkit 1.x - your code imports version 1.0
4. I've not been able to figure out how to get to the underlying QWebPage of the QML web page to change its UA.
5. If you use a QWebPage as an object inside your QML, you will be able to subclass it to change the UA.
__________________
qgvdial: Google Voice client. All downloads
qgvtp: Phone integration for the n900 that dials out and sends texts using qgvdial.
mosquitto: message broker that implements the MQ Telemetry Transport protocol version 3.
qgvnotify: Google voice and contacts notifier for diablo and maemo.

If you want to thank me, click the Thanks button.
If you'd like to thank my applications, vote to move them to extras.
 

The Following User Says Thank You to uvatbc For This Useful Post:
helex's Avatar
Posts: 543 | Thanked: 802 times | Joined on Apr 2010 @ Germany
#3
Thanks for your reply, uvatbc!

Originally Posted by uvatbc View Post
3. QML uses Webkit 1.x - your code imports version 1.0
Oh, yes. You're right. I dropped this line in the very beginning and have it totally forgotten during searching what I could change at my code to get the new webpage.

Hence there is no QtWebkit 2.0 to import I'm now quite sure this small project won't work without access to the engine of the build in browser. Fenec (Firefox) and Opera are getting the old mobile twitter page, too.
__________________
I was a Qt Ambassador!

Please DONATE if you like my work!
It's the best way to motivate me to create more stuff for your Device.
 
Bundyo's Avatar
Posts: 4,708 | Thanked: 4,649 times | Joined on Oct 2007 @ Bulgaria
#4
WebKit2 is only process separation branch, hence probably not much difference from the QML WebKit widget.

If you manage to run it before the Twitter scripts, you can change the userAgent directly in the page by using __defineGetter__

Code:
window.navigator.__defineGetter__("userAgent", function () { return "new UA" });
__________________
Technically, there are three determinate states the cat could be in: Alive, Dead, and Bloody Furious.

Last edited by Bundyo; 2011-12-12 at 19:31.
 

The Following 2 Users Say Thank You to Bundyo For This Useful Post:
helex's Avatar
Posts: 543 | Thanked: 802 times | Joined on Apr 2010 @ Germany
#5
Originally Posted by Bundyo View Post
If you manage to run it before the Twitter scripts, you can change the userAgent directly in the page by using __defineGetter__
Hmm... A QML only solution is not possible?
__________________
I was a Qt Ambassador!

Please DONATE if you like my work!
It's the best way to motivate me to create more stuff for your Device.
 
Reply

Tags
qtwebkit, twitter


 
Forum Jump


All times are GMT. The time now is 22:11.