//flex table opened by JP

Click to See Complete Forum and Search --> : View Page Source...


cusimar9
05-17-2005, 08:02 AM
Is there any way of viewing the HTML of a webpage?

I don't mean the page source... the ACTUAL HTML?

I've a page written entirely in Javascript and its getting a little difficult to debug... it'd be handy to see what's actually being written in HTML...

Hola hoop
05-17-2005, 12:40 PM
Whats the difference between source code and ACTUAL HTML?
AS far as i knew the code is the actual htm language.
If u mean u want to see the resulting html from your javascript code i cant see why u cant see that.

Sorry if i got wrong end of stick

:t

tantone
05-17-2005, 12:57 PM
javascript is run on the local computer, so the resulting page source (however changed by the javascript) is always going to look the same. It's not like ASP or PHP where the actual HTML code you created is completely different from what the user will see when they view the source--for them, the source will be the result of the ASP or PHP code.

cusimar9
05-17-2005, 01:03 PM
Hola Hoop

Consider this javascript code:

for (i = 1; i <= max_days; i++)
{
if (i < 5) document.write("<b>Hello</b>");

if ((i >= 5) && (i < 8)) document.write("<i>Hello</i>");
}

This script would be run on the local computer and would result in a bunch of HTML which the browser would then display.

Do the HTML is created from the javascript

So... is there any way of seeing the resulting HTML of a javascript?

Hola hoop
05-17-2005, 01:28 PM
Im sorry cusimar9 if i have misunderstood,

Dont u have a testing server to see the results?
If not install ISS with windows Pro to run script on your local machine to test

Maybe use dreamweavers function to create a testing site and server from within on local machine

When i was testing my ASP pages i could only verify the HTML on a testing server to see what i was producing with my code.

:t

ScaryBinary
05-17-2005, 02:43 PM
Can you use the Microsoft Script Editor to debug? I forget how that actually gets installed....

I think the following is true (someone please correct me if I am wrong....). It's also pretty high-level, but you get the idea....

First, there are server-side scripts and client-side scripts.

When you visit a website that uses ASP pages or PHP pages, those pages are first being generated on the associated webserver (NOT your computer). That webserver then sends the resulting page to your browser. When you use the "View Source" feature on such a page, what you are viewing is whatever was generated and sent by the server-side script --- NOT the actual script itself. So, you can't view the actual ASP code or PHP code for a website, because each time you request the page the webserver runs the script and gives your browser the output (which is usually HTML).

Client-side scripts are run on your machine. Javascript is a client-side script. Since YOUR browser has to run the script, when you request a page that includes a javascript the associated webserver has to send the script to your browser. This is why when you view the source of an HTML page you can see the javascripts.

The fallout of this, I believe, is that whatever modifications are done to the HTML by the javascript are NOT viewable by the "View Source" feature becuase the "View Source" feature shows you what was received by your browser -- which is the original HTML and the javascript source code. Any dynamic modification you do to the HTML object after that isn't available to you (using the "View Source" menu), because it's not what was sent to your browser.

So, if you have an HTML page that is generated completely by Javascript, all you'll ever be able to see using the "View Source" feature is the script itself, because that's all your browser ever received.

I did find an application called the IE DOM Inspector (http://www.ieinspector.com/dominspector/index.html) that reportedly lets you see the real-time modifications to your HTML document. It ain't free, though.

cusimar9
05-17-2005, 03:05 PM
Thats correct ScaryBinary :)

I just wandered if there was a simple way of viewing it, but it doesn't appear that there is.

Shame... I would have thought that should be a fairly straightforward but quite useful program.

If I had the time I'd write it myself, but priorities have changed somewhat recently :D