当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - Save and retrive HTML and .aspx Webpage in Titanium SDK

问题描述:

How to save and retrive the HTML and .aspx Webpage in Titanium SDK.

For Display in offline.

i seen this link. but it returns an image. i need as webpage.

Edit:- (see answer)

now am able to save webpage and retive sucess. but inside webpage some of javascript file, images are there. how to get those files...

网友答案:

Its Work fine.

var xhr = Titanium.Network.createHTTPClient({
    onload: function(e) {
          var returnValue = this.responseText;
          Ti.API.info(this.responseText);

          var f = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory,'file.html');
                if(f.exists()==false) {
                     Ti.API.info('false');

                      // you don't need to do this, but you could...
                      f.createFile();
                }
                f.write(this.responseText);
                Ti.API.info('Files dir path : ' + Ti.Filesystem.applicationDataDirectory);

           Titanium.App.Properties.setString("URRL", Ti.Filesystem.applicationDataDirectory+'file.html');
           urrl = Ti.App.Properties.getString('URRL');
           webview.setUrl(urrl);

           },
           timeout: 10000
});
webservice();
function webservice() {
        xhr.open('GET','http://msdn.microsoft.com/en-us/library/015103yb(v=vs.100).aspx');
        xhr.send();
}
分享给朋友:
您可能感兴趣的文章:
随机阅读: