Hi,
    I am trying to figure out how to know one page is "totally"
loaded. I tried the DocumentLoaded() function, but it is called
multiple times when loading one page. My guess: it is called whenever
one iframe is finished loading.

SYMPTOM:    Try this web site:   www.sina.com.cn   and  DocumentLoaded
()  will be called multiple times.

QUESTION: how to know one page is "totally" loaded?

DETAILS ABOUT WHAT I DID:

I am using the "mozembed" from this page: 
https://wiki.mozilla.org/Embedding/NewApi#Getting_the_code

in /mozembed/gtk/tests/test.cpp,
I added

    g_signal_connect(view,"document_loaded",G_CALLBACK
(my_loaded),view);

to "add_page()" function:
==================================================
GtkWidget *
add_page(GtkNotebook *notebook)
{
    GtkWidget *view = moz_web_view_new();
    GtkWidget *box = gtk_hbox_new(FALSE, 5);
    GtkWidget *tab_label = gtk_label_new("Loading...");
    GtkWidget *close_button = gtk_button_new();
    gtk_button_set_relief(GTK_BUTTON(close_button), GTK_RELIEF_NONE);

    GtkWidget *close = gtk_image_new_from_stock(GTK_STOCK_CLOSE,
                                                GTK_ICON_SIZE_MENU);
    gtk_container_add(GTK_CONTAINER(close_button), close);

    gtk_box_pack_start(GTK_BOX(box), tab_label, TRUE, TRUE, 0);
    gtk_box_pack_end(GTK_BOX(box), close_button, FALSE, FALSE, 0);

    gtk_widget_show_all(box);
    gtk_widget_show(view);

    g_signal_connect(view, "title-changed", G_CALLBACK(title_cb),
tab_label);
    g_signal_connect(view, "location-changed", G_CALLBACK
(location_cb), NULL);
    g_signal_connect(view, "status-changed", G_CALLBACK(status_cb),
NULL);
    g_signal_connect(close_button, "clicked", G_CALLBACK(close_cb),
view);

////////////////Hui
    g_signal_connect(view,"document_loaded",G_CALLBACK
(my_loaded),view);
////////////////Hui

    moz_web_view_load_uri(MOZ_WEB_VIEW(view), "http://
www.google.com");

    int page = gtk_notebook_append_page(notebook, view, box);
    gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook), page);

    return view;
}
===================================================
where "my_loaded" is the function I am calling whenever after
DocumentLoaded() is called.
In this way, I detected DocumentLoaded() called multiple times when I
am loading  www.sina.com.cn   by simply printing out something in
"my_loaded()", actually it is called seven times, corresponding to
seven iframes in that web page.

Your help is deeply appreciated.

_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding

Reply via email to