diff options
Diffstat (limited to 'examples/qmlapp')
-rw-r--r-- | examples/qmlapp/index.html | 12 | ||||
-rw-r--r-- | examples/qmlapp/qmlapp.qml | 2 |
2 files changed, 12 insertions, 2 deletions
diff --git a/examples/qmlapp/index.html b/examples/qmlapp/index.html index b6a7aa9..e5830b3 100644 --- a/examples/qmlapp/index.html +++ b/examples/qmlapp/index.html @@ -1,7 +1,17 @@ <html> <head> - <script src="../../src/qwebchannel.js"></script> <script> + 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>'); + window.onload = function() { var textArea = document.querySelector("textarea"); function output(x) { diff --git a/examples/qmlapp/qmlapp.qml b/examples/qmlapp/qmlapp.qml index bdd1b4c..e15ff97 100644 --- a/examples/qmlapp/qmlapp.qml +++ b/examples/qmlapp/qmlapp.qml @@ -21,7 +21,7 @@ Rectangle { height: 200 settings.localContentCanAccessRemoteUrls: true settings.developerExtrasEnabled: true - url: "index.html?webchannel_baseUrl=" + webChannel.baseUrl + url: "index.html?webChannelBaseUrl=" + webChannel.baseUrl } TextEdit { |