What is the difference between "Source" and "Generated Source" in Firefox?
Please explain with example.
Edit: 3 July
Which source "Search engine" uses, Generated or before generated?
View source will show the source that was served by the server.
View generated source will show the source code of what's actually being shown — that includes what JavaScript has changed, etc.
Source will show the source that the page was loaded with (served by the server).
Generated source will draw 'source code' from the current DOM elements, and therefore includes elements dynamically created by JavaScript.
For example, source would show:
<script>
window.onload = function(){
document.getElementById('test').innerHTML = 'Generated Content';
}
</script>
<html>
<div id='test'>Source</div>
</html>
and Generated Source would 'draw' the source at the time you click 'View Generated Source', after which the div's contents have been changed, and you would see:
<script>
window.onload = function(){
document.getElementById('test').innerHTML = 'Generated Content';
}
</script>
<html>
<div id='test'>Generated Content</div> <!-- Note the difference here -->
</html>
It's really pretty simple.
Source:
<body>
<script>document.write("hello, world");</script>
</body>
Generated source:
<body>
<script>document.write("hello, world");</script>
hello, world
</body>
More verbosely: "source" is what arrives at the browser in response to the page request. "Generated source" is what the browser has after all the javascript fires.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With