On 26 nov, 11:50, Blaine Monkey <[email protected]> wrote:
> I've a Linux C++ application with mozilla browser embedded.
> The embedded browser shows the google page well.
> I made a simple page with some javascript code, to do a test. The page has a
> table with a text and the javascript changes the text with an image. If I
> open the page with firefox it shows fine, but the embedded browser only
> shows the text. Embedded browser supports javascript as firefox, in't it?
> What's the problem?
>
> Here is the source code:
>
> <html>
> <head><title>TESTING</title>
> <script src="buildTable.js" type="text/javascript"></script>
> </head>
> <body bgColor="yellow" onload="buildTable();">
> <table id="myTable" border="2" width="400" height="400"><tr><td><span>
> TEXT </span></td</tr><table/>
>
> </body>
> </html>
>
> // And this is the code of buildTable.js file:
> function buildTable(){
> var build = '<tr><td><img src="food020.jpg" width="100"
> height="100"></img></td></tr>';
> document.all.myTable.innerHTML=build;
>
> }
I set the SETUP_ALLOW_JAVASCRIPT property to true but doesn't work.
webBrowser = do_CreateInstance(NS_WEBBROWSER_CONTRACTID, &rv);
if (NS_FAILED(rv)) {
printf("do_CreateInstance webBrowser\n");
}
browserSetup = do_QueryInterface(webBrowser,&rv);
if (NS_FAILED(rv)) {
printf("do_QueryInterface browserSetup\n");
}
browserSetup->SetProperty
(nsIWebBrowserSetup::SETUP_ALLOW_PLUGINS,PR_TRUE);
browserSetup->SetProperty
(nsIWebBrowserSetup::SETUP_ALLOW_JAVASCRIPT,PR_TRUE);
browserSetup->SetProperty
(nsIWebBrowserSetup::SETUP_ALLOW_IMAGES,PR_TRUE);
browserSetup->SetProperty
(nsIWebBrowserSetup::SETUP_ALLOW_META_REDIRECTS,PR_TRUE);
browserSetup->SetProperty
(nsIWebBrowserSetup::SETUP_ALLOW_SUBFRAMES,PR_TRUE);
browserSetup->SetProperty
(nsIWebBrowserSetup::SETUP_IS_CHROME_WRAPPER,PR_FALSE);
baseWindow = do_QueryInterface(webBrowser);
rv = baseWindow->InitWindow(window, 0, 0, 0, 1300, 700);
if (NS_FAILED(rv)) {
printf("InitWindow\n");
}
rv = baseWindow->Create();
if (NS_FAILED(rv)) {
printf("Create\n");
}
rv =baseWindow->SetVisibility(PR_TRUE);
if (NS_FAILED(rv)) {
printf("SetVisibility\n");
}
webNavigation = do_QueryInterface(webBrowser);
rv = webNavigation->LoadURI(NS_ConvertASCIItoUTF16(argv[1]).get
(),nsIWebNavigation::LOAD_FLAGS_NONE , 0, 0, 0);
if (NS_FAILED(rv)) {
printf("LoadURI\n");
}
g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK
(delete_event), 0);
gtk_main();
XRE_TermEmbedding();
XPCOMGlueShutdown();
exit(0);
_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding