I am gradually being forced into using JavaScript against my will. One of the disadvantages is the generated HTML is both invisible and not validated.
Is there any way to see the generated code, or to get it validated? perhaps by inserting some dummy functions.s
JavaScript
- Albert Wiersch
- Site Admin
- Posts: 3783
- Joined: Sat Dec 11, 2004 9:23 am
- Location: Near Dallas, TX
- Contact:
Re: JavaScript
This is a good question but I am not aware of any good solutions.
Perhaps you could also put any JavaScript generated HTML in a "textarea" element for copying and pasting into CSE HTML Validator... but this would obviously need some manual intervention.
Perhaps you could also put any JavaScript generated HTML in a "textarea" element for copying and pasting into CSE HTML Validator... but this would obviously need some manual intervention.
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
- MikeGale
- Rank VI - Professional
- Posts: 726
- Joined: Mon Dec 13, 2004 1:50 pm
- Location: Tannhauser Gate
Re: JavaScript
This is along standing problem.
There are a number of partial solutions (some browsers only, might inject some "extras"...) which in their native form involve manual intervention.
In essence the raw source disappears when the browser builds a DOM. If you write good markup, the difference will be small. For those who write tag soup and rubbish markup, the changes can be significant as the browser fixes the errors. Potentially different browsers might interpret source and changes differently, though the diversity is disappearing
Anything you use will convert the DOM to a textual format.
Here's some solutions I got from a quick search on the web, no guarantees:
Viewing generated HTML. Some crude notes 2014/08/24 20:26:14, from a web survey, not tested or analysed, some are old, none is likely to work in all browsers.
IE.
https://www.squarefree.com/bookmarklets ... ted_source
ViewSourceChartBookmarket
http://viewsourcechart.com/
Javascript (for bookmarklets, URLBar...)
A good solution would be to automate your selected suite of browsers and automatically write the content to dB, file etc. then analyse. This looked like hard work last time I investigated it, if you do it I'd appreciate some details of what you end up doing.
When I've done this sort of thing, it's manually and I analyse the content of captures with CSE. The captures go into a web site, with associated baggage like css, images etc. With many designs there is not one generated page (per web page) but several at different "stages" of the process.
You can compare source / capture of content on the wire (where server generates content) using diff tools (though formatting and casing of tags may need a little work).
Let me know how you go.
There are a number of partial solutions (some browsers only, might inject some "extras"...) which in their native form involve manual intervention.
In essence the raw source disappears when the browser builds a DOM. If you write good markup, the difference will be small. For those who write tag soup and rubbish markup, the changes can be significant as the browser fixes the errors. Potentially different browsers might interpret source and changes differently, though the diversity is disappearing
Anything you use will convert the DOM to a textual format.
Here's some solutions I got from a quick search on the web, no guarantees:
Viewing generated HTML. Some crude notes 2014/08/24 20:26:14, from a web survey, not tested or analysed, some are old, none is likely to work in all browsers.
IE.
- Try going to the HTML tab in IE developer tools and press the refresh icon (next to the save icon), it will show the latest DOM.
F12 -> F5 -> Ctl-S
(Load dev tool, refresh, Save as file.) - Code: javascript:window.open("").document.open("text/plain", "").write(document.documentElement.outerHTML);
- In Firebug's HTML tab, right-click the root node and select "copy HTML". Then paste to a text editor.
- Bookmarklet: javascript: var win = window.open(); win.document.write('<html><head><title>Generated HTML of ' + location.href + '</title></head><pre>' + document.documentElement.innerHTML.replace(/&/g, '&').replace(/</g, '<') + '</pre></html>'); win.document.close(); void 0;
https://www.squarefree.com/bookmarklets ... ted_source
ViewSourceChartBookmarket
http://viewsourcechart.com/
Javascript (for bookmarklets, URLBar...)
- javascript:alert(document.body.innerHTML)
- javascript:void(window.open("javascript:document.open(\"text/plain\");document.write(opener.document.body.parentNode.outerHTML)"))
- http://omnicode.blogspot.co.uk/2008/05/ ... in-ie.html
- http://stackoverflow.com/questions/3314 ... in-firefox
- http://stackoverflow.com/questions/8298 ... t-explorer
A good solution would be to automate your selected suite of browsers and automatically write the content to dB, file etc. then analyse. This looked like hard work last time I investigated it, if you do it I'd appreciate some details of what you end up doing.
When I've done this sort of thing, it's manually and I analyse the content of captures with CSE. The captures go into a web site, with associated baggage like css, images etc. With many designs there is not one generated page (per web page) but several at different "stages" of the process.
You can compare source / capture of content on the wire (where server generates content) using diff tools (though formatting and casing of tags may need a little work).
Let me know how you go.