view-source without reload the page

M

micchy

Dear everyone,

I'd like to know if 'view-source' in javascript can work without
reloading the page. (or not calling the page again, just as I
right-click in IE)

Thanks for your help!

micchy
 
R

Richard Cornford

micchy said:
I'd like to know if 'view-source' in javascript can work
without reloading the page. (or not calling the page again,
just as I right-click in IE)

There is no "view-source" in JavaScript so what you are doing must be
some scripted attempt to view some source or another. But without seeing
how you are going about this it is impossible to see why it is reloading
the page or how it could be done differently to avoid that.

The wild speculation would be that it is the usually failing to return
false from the code within an onclick attribute of a line with a "#"
HREF.

Richard.
 
E

Evertjan.

micchy wrote on 16 jan 2004 in comp.lang.javascript:
I'd like to know if 'view-source' in javascript can work without
reloading the page. (or not calling the page again, just as I
right-click in IE)

<a href="#"
onclick="location.href='view-source:'+location.href">
View-source</a>

<br>

<a href="#"
onclick="w=window.open('');
w.document.body.innerText=document.body.outerHTML.replace(/</g,'\n<')">
View-body</a>

[be(a)ware of extra linebreaks]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top