Skip to content

Commit

Permalink
Rendered HTML can now be viewed in the "Response Body with syntax hig…
Browse files Browse the repository at this point in the history
…hlight" tab
  • Loading branch information
stiak committed Jan 20, 2011
1 parent 27cbfb0 commit 3cd1366
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion content/restclient.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,11 @@ var restclient = {
if (contentType.indexOf("image") >= 0) {
this.displayImage(xmlHttpRequest.responseText, contentType);
} else {
responseBody.value = xmlHttpRequest.responseText;
responseBody.value = xmlHttpRequest.responseText;
}

if (contentType.indexOf("html") >= 0) {
this.displayHtml(xmlHttpRequest.responseText);
}

if (contentType.indexOf("json") >= 0) {
Expand Down Expand Up @@ -367,6 +371,23 @@ var restclient = {

document.getElementById("xmlContent").appendChild(hbox);
},

displayHtml: function(responseData) {
var iframe = document.createElement("iframe");
iframe.setAttribute("type", "content");
iframe.setAttribute("flex", "1");

var docShell = iframe.getAttribute("docShell");
docShell.allowAuth = false;
docShell.allowJavascript = false;
docShell.allowMetaRedirects = false;
docShell.allowPlugins = false;
docShell.allowSubframes = false;

iframe.setAttribute("src", "data:text/html," + encodeURIComponent(responseData));

document.getElementById("xmlContent").appendChild(iframe);
},

clearRequest: function(){
var requestUrl = document.getElementById('tbRequestUrl');
Expand Down

0 comments on commit 3cd1366

Please sign in to comment.