<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qmlglobalobject.qdoc --> <title>QML Global Object | Qt QML 5.9</title> <link rel="stylesheet" type="text/css" href="style/offline-simple.css" /> <script type="text/javascript"> document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css"); // loading style sheet breaks anchors that were jumped to before // so force jumping to anchor again setTimeout(function() { var anchor = location.hash; // need to jump to different anchor first (e.g. none) location.hash = "#"; setTimeout(function() { location.hash = anchor; }, 0); }, 0); </script> </head> <body> <div class="header" id="qtdocheader"> <div class="main"> <div class="main-rounded"> <div class="navigationbar"> <table><tr> <td >Qt 5.9</td><td ><a href="qtqml-index.html">Qt QML</a></td><td >QML Global Object</td></tr></table><table class="buildversion"><tr> <td id="buildversion" width="100%" align="right">Qt 5.9.4 Reference Documentation</td> </tr></table> </div> </div> <div class="content"> <div class="line"> <div class="content mainContent"> <div class="sidebar"> <div class="toc"> <h3><a name="toc">Contents</a></h3> <ul> <li class="level1"><a href="#xmlhttprequest">XMLHttpRequest</a></li> </ul> </div> <div class="sidebar-content" id="sidebar-content"></div></div> <h1 class="title">QML Global Object</h1> <span class="subtitle"></span> <!-- $$$qtqml-javascript-qmlglobalobject.html-description --> <div class="descr"> <a name="details"></a> <p>The QML JavaScript host environment implements the following host objects and functions. These are built in and can be used from any JavaScript code loaded in QML, without additional imports:</p> <ul> <li>The <a href="qml-qtqml-qt.html">Qt object</a>: This object is specific to QML, and provides helper methods and properties specific to the QML environment.</li> <li>qsTr(), qsTranslate(), qsTrId(), QT_TR_NOOP(), QT_TRANSLATE_NOOP(), and QT_TRID_NOOP() functions: These functions are specific to QML, and provide translation capabilities to the QML environment.</li> <li>gc() function: This function is specific to QML, and provides a way to manually trigger garbage collection.</li> <li>print() function: This function is specific to QML, and provides a simple way to output information to the console.</li> <li>The console object: This object implements a subset of the <a href="http://getfirebug.com/wiki/index.php/Console_API">FireBug Console API</a>.</li> <li><a href="qtqml-javascript-qmlglobalobject.html#xmlhttprequest">XMLHttpRequest</a>, DOMException: These objects implement a subset of the <a href="http://www.w3.org/TR/XMLHttpRequest/">W3C XMLHttpRequest specification</a>.</li> </ul> <p><b>Note: </b>The <a href="qjsengine.html#globalObject">globalObject()</a> function cannot be used to modify the global object of a <a href="qqmlengine.html">QQmlEngine</a>. For more information about this, see <a href="qtqml-javascript-hostenvironment.html#javascript-environment-restrictions">JavaScript Environment Restrictions</a>.</p><a name="xmlhttprequest"></a><a name="xmlhttprequest"></a> <h2 id="xmlhttprequest">XMLHttpRequest</h2> <p>The <a href="qtqml-javascript-qmlglobalobject.html#xmlhttprequest">XMLHttpRequest</a> object, which can be used to asynchronously obtain data from over a network.</p> <p>The <a href="qtqml-javascript-qmlglobalobject.html#xmlhttprequest">XMLHttpRequest</a> API implements the same <a href="http://www.w3.org/TR/XMLHttpRequest/">W3C standard</a> as many popular web browsers with following exceptions:</p> <ul> <li>QML's <a href="qtqml-javascript-qmlglobalobject.html#xmlhttprequest">XMLHttpRequest</a> does not enforce the same origin policy.</li> </ul> <p>Additionally, the <code>responseXML</code> XML DOM tree currently supported by QML is a reduced subset of the <a href="http://www.w3.org/TR/DOM-Level-3-Core/">DOM Level 3 Core</a> API supported in a web browser. The following objects and properties are supported by the QML implementation:</p> <div class="table"><table class="generic"> <thead><tr class="qt-style"><th ><b>Node</b></th><th ><b>Document</b></th><th ><b>Element</b></th><th ><b>Attr</b></th><th ><b>CharacterData</b></th><th ><b>Text</b></th></tr></thead> <tr valign="top" class="odd"><td ><ul> <li>nodeName</li> <li>nodeValue</li> <li>nodeType</li> <li>parentNode</li> <li>childNodes</li> <li>firstChild</li> <li>lastChild</li> <li>previousSibling</li> <li>nextSibling</li> <li>attributes</li> </ul> </td><td ><ul> <li>xmlVersion</li> <li>xmlEncoding</li> <li>xmlStandalone</li> <li>documentElement</li> </ul> </td><td ><ul> <li>tagName</li> </ul> </td><td ><ul> <li>name</li> <li>value</li> <li>ownerElement</li> </ul> </td><td ><ul> <li>data</li> <li>length</li> </ul> </td><td ><ul> <li>isElementContentWhitespace</li> <li>wholeText</li> </ul> </td></tr> </table></div> <p>The <a href="qtqml-xmlhttprequest-example.html">XMLHttpRequest example</a> demonstrates how to use the <a href="qtqml-javascript-qmlglobalobject.html#xmlhttprequest">XMLHttpRequest</a> object to make a request and read the response headers.</p> </div> <!-- @@@qtqml-javascript-qmlglobalobject.html --> </div> </div> </div> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2017 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.<br> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.<br> Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners. </p> </div> </body> </html>