Forum Moderators: open
i think its possible but not sure how. scenario is this
File:test.html
---------------
<html>
<body>
<script language="JavaScript" src="link.js"></script>
</body>
</html>
-------------
file: link.js
document.write("<a href=testing.com>Testing</a>");
now this works just as expected, test.html will show a link to testing.com but ofcourse it doesnt show the a href tag in html. its runtime generated by javascript. can there be any way that the link html also shows in final html output of the test.html file?
or in simple words is it possible to grab some html from somewhere (your own and same server) and then show it on your page and it also shows in the html output sent to browser?
Take a look at this, it might be what you want - not sure.
[disruptive-innovations.com...]
You might also consider using iframes that are hidden by javascript which then goes on to use the innerHTML property to inject the code into the page. HOWEVER, be aware that any javascript method used to include text/html will not be indexed by search engines.
Kaled.
The webdeveloper toolbar plugin for Firefox has the additional option to "View Generated Source" - this, as you might expect, effectively shows you the source of the page, after JS has had its way (what the client is actually seeing).
The only reason to look at JavaScript/DOM code is for debugging, and the WebDeveloper Toolbar is good for that. Be aware, however, that it does not generate valid code. It generates early HTML-level code (not XML-compliant), so it can look a bit odd. It uses the Mozilla engine for its generation.
It's explained here [chrispederick.com].