开发者

Qt.openUrlExternally() sometimes works on Symbian^3 and sometimes not, why is this?

I am having some difficulty with Qt.openUrlExternally on Symbian^3. Sometimes it works, sometimes not, and I can't find any pattern to it.

Another user seems to be having the same problem here.

When it does not work, the actual behaviour is that a web browser opens, comes to the foreground briefly (for a few seconds), then goes to the background. It is still open, but the URL does not load.

Qt.openUrlExternally("http://www.stackoverflow.com") works.

Qt.openUrlExternally("http://twitter.com/share?text=ZOMG") fails. I initially concluded that this meant any URL with ? does not work, however this is wrong because...

Qt.openUrlExternally("http://twitter.com/intent/tweet?text=ZOMG") works. However, it seems to work for one word only because:

Qt.openUrlExternally("http://twitter.com/intent/tweet?text=Will%20this%20work") fails.

Has 开发者_开发技巧anyone encountered a similar issue (specifically for sending arbitrary text to Twitter I suppose), and what have they done about it?


OK, had an result on this on the Qt forum. Qt.openUrlExternally does not seem to like URLs containing %20 as an escaped space. + works. (This brought to my attention that my second assertion above was wrong, http://twitter.com/share?text=ZOMG does work).

The solution seems to be to pass the URI parameter through Javascript's encodeURIComponent() function and replace all resulting %20s with +s.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜