diff options
author | No'am Rosenthal <noam.rosenthal@nokia.com> | 2011-08-04 18:27:53 -0700 |
---|---|---|
committer | No'am Rosenthal <noam.rosenthal@nokia.com> | 2011-08-04 18:27:53 -0700 |
commit | 5c8e0d25efe2a7d9947dce3d1e867afb13099c60 (patch) | |
tree | c78017a5646dc4ca41342de59185af91cece5ee7 /examples | |
parent | f68003767b1aee5f6f6be9ac21d36e212956c11a (diff) | |
download | qtwebchannel-5c8e0d25efe2a7d9947dce3d1e867afb13099c60.tar.gz |
Use regexp for finding the baseUrl parameter
Diffstat (limited to 'examples')
-rw-r--r-- | examples/qmlapp/index.html | 12 | ||||
-rw-r--r-- | examples/qmlapp/qmlapp.qml | 4 |
2 files changed, 3 insertions, 13 deletions
diff --git a/examples/qmlapp/index.html b/examples/qmlapp/index.html index e062e83..40843a7 100644 --- a/examples/qmlapp/index.html +++ b/examples/qmlapp/index.html @@ -1,17 +1,7 @@ <html> <head> <script> - document.body.innerHTML = JSON.stringify(location); - function getWebChannelBaseUrl() { - var query = window.location.search.substring(1); - var vars = query.split("&"); - for (var i=0;i<vars.length;i++) { - var pair = vars[i].split("="); - if (pair[0] == "webChannelBaseUrl") - return pair[1]; - } - } - document.write('<script src="' + getWebChannelBaseUrl() + '"><' + '/script>'); + document.write('<script src="' + (/[?&]webChannelBaseUrl=([A-Za-z0-9\-:/]+)/.exec(location.search)[1]) + '"><' + '/script>'); function output(x) { document.querySelector("#out").innerHTML += x + "<br/>"; diff --git a/examples/qmlapp/qmlapp.qml b/examples/qmlapp/qmlapp.qml index 440c532..8a9122e 100644 --- a/examples/qmlapp/qmlapp.qml +++ b/examples/qmlapp/qmlapp.qml @@ -24,8 +24,8 @@ Rectangle { url: "index.html?webChannelBaseUrl=" + webChannel.baseUrl ; settings.developerExtrasEnabled: true anchors.top: txt.bottom - height: 200 - width: 200 + height: 2000 + width: 2000 } TextEdit { |