Reputation: 1
I am at work and we use Internet Explorer 8 with some security. Normally if I needed to get source code I would simply right click, view source, but I see no option for that on the right click menu.
The browser does allow code in the address bar so I came up with this
javascript:alert(document.body.innerHTML)
However this present problem if the page is very large, as you cannot scroll the Internet Explorer alert box. What would be a snippet I could use to display page source code, that is scrollable?
Note it shouldnt matter whether it is the "original" source or the "rendered" source, but if you have both options that would be nice.
Upvotes: 0
Views: 3940
Reputation: 3848
Prepare your snippet in jsFiddle!
For example you could create a pre element, append it to document and set text to the document's source!
var head = document.head.innerHTML;
var body = document.body.innerHTML;
var element = document.createElement("pre");
element.innerText = "<html><head>" + head + "</head><body>" + body + "</body></html>";
document.body.appendChild(element);
Now remove all line-breaks, copy and paste it into address bar and run! It's tested ;)
javascript: var head = document.head.innerHTML; var body = document.body.innerHTML; var element = document.createElement("pre"); element.innerText = "<html><head>" + head + "</head><body>" + body + "</body></html>"; document.body.appendChild(element);
Upvotes: 1