How to get the source for a webpage page using C/C++?
Scenario: I'm in a JavaScript callback (for example the callHook
callback) and I have a JSContext * and a JSScript at my disposal. How
can I get the page source code for this page?
One answer is get the filename from the script. That is great if its a
local filename such as c:\myWebPage.html as I can open that using
fopen() etc.
However if its a non-local file such as http://someWebAddress/page.html
or one of the chrome:// pages then I can't open that. I don't want to
fetch the page myself as the page content may be different for each call
- I want the same source as the page which resulted in my script being
called.
I've looked at the source for many days and weeks and this has defeated
me. None of the JSD_* calls appear to be publicly available as DLL
exports so I can't use those. Following ID_VIEW_SOURCE resource ids led
me to some code which eventually displays the source code, but it does
that in a Mozilla window and I lost track of the point at which the page
code is available and then sent to the window. I require just the page
source as an ANSI or Unicode string or character pointer, not a window
containing the source.
If it makes any difference to the question I'm working on a Windows box.
Given its cross platform I doubt it will make a difference, but thought
I should mention it anyway.
Does anyone know how to do this?
If I've posted this to the wrong newsgroup please tell me where I should
have posted this question. Hoping someone can help.
I've already tried netscape.public.mozilla.browser and was pointed at
this newsgroup.
Stephen
--
Stephen Kellett
Object Media Limited http://www.objmedia.demon.co.uk/software.html
Computer Consultancy, Software Development
Windows C++, Java, Assembler, Performance Analysis, Troubleshooting
_______________________________________________
mozilla-embedding mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-embedding