如何在FireFox操作系统中下载网页内容?

如何在FireFox操作系统中下载网页内容?,firefox,firefox-os,Firefox,Firefox Os,用jquery尝试了这个方法,但没有任何效果。您能做一个SystemXHR吗?Robert Nyman的样板展示了一个例子: var gethtml = document.querySelector("#gethtml"); if (gethtml) { gethtml.onclick = function () { $('#gethtml-presenter').load('http://asd.com/rss/').fadeIn('slow'); a

用jquery尝试了这个方法,但没有任何效果。

您能做一个SystemXHR吗?Robert Nyman的样板展示了一个例子:

var gethtml = document.querySelector("#gethtml");
if (gethtml) {
    gethtml.onclick = function () {
        $('#gethtml-presenter').load('http://asd.com/rss/').fadeIn('slow'); 
        addNotification("hello", "downloaded page");            
    }
}

顺便说一句,确保将systemXHR权限添加到清单中
var crossDomainXHR = document.querySelector("#cross-domain-xhr"),
    crossDomainXHRDisplay = document.querySelector("#cross-domain-xhr-display");
 if (crossDomainXHR && crossDomainXHRDisplay) {
    crossDomainXHR.onclick = function () {
        var xhr = new XMLHttpRequest({mozSystem: true});
        xhr.open("GET", "http://www.google.com", true);
        xhr.onreadystatechange = function () {
            if (xhr.status === 200 && xhr.readyState === 4) {
                crossDomainXHRDisplay.innerHTML = "<div class='fade-in'>" + xhr.response+"</div>";
                crossDomainXHRDisplay.style.display = "block";
            }
        }

        xhr.onerror = function () {
            crossDomainXHRDisplay.innerHTML = "<h4>Result from Cross-domain XHR</h4><p>Cross-domain XHR failed</p>";
            crossDomainXHRDisplay.style.display = "block";
        };
        xhr.send();
    };
}
.fade-in {
    text-align: center;
    animation: fadein 5s;
    -moz-animation: fadein 5s; /* Firefox */
}
@keyframes fadein {
    from {
        opacity:0;
    }
    to {
        opacity:1;
    }
}
@-moz-keyframes fadein { /* Firefox */
    from {
        opacity:0;
    }
    to {
        opacity:1;
    }
}