Hi Tomasz,
I met the same problem weeks ago. I found two ways doing that:
1. Simply use nsIWebNavigation->LoadURI(javascript:exp)
The piece of code working in my place is:
......
char *jscript = document.bgColor='yellow';alert('a test message');
const int MAX_JSCRIPTURI_LENGTH = 8192;
char jscriptURI[MAX_JSCRIPTURI_LENGTH];
strcat(jscriptURI, "javascript:"); strcat(jscriptURI, "javascript:"); strcat(jscriptURI, jscript);
nsEmbedString unicodeURI;
......
ConvertAsciiToUtf16(jscriptURI, unicodeURI);
aWebNav->LoadURI(unicodeURI.get(),
nsIWebNavigation::LOAD_FLAGS_NONE,
nsnull,
nsnull,
nsnull);
The good thing is, nsIWebNavigation is frozen in 1.8, but it can't return a value.
Though I worked around it in another way.
2. Use JS_EvaluateScript. Check: http://www.mozilla.org/js/spidermonkey/apidoc/jsguide.html
The problem is, you'll have to use the internal, unfrozen interface: nsIScriptGlobalObject
You can search the archive of this alias for more information.
Hope it helps. -George.
-George.
My application (based on MFCEmbed example) works fine, but JavaScript scripts are ignored when page is loaded.
How to enable running scripts on loaded page?
If it is simple on/off thing tell me how to turn it on, if it is more complex please tell me some keywords, so I'll google it myself.
_______________________________________________
mozilla-embedding mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-embedding
_______________________________________________ mozilla-embedding mailing list [email protected] http://mail.mozilla.org/listinfo/mozilla-embedding
