[webkit-gtk] Window.Open and relative url
Adrien Schwartzentruber
adrien.schwartzentruber at gmail.com
Mon Feb 2 05:14:01 PST 2015
Helly guys,
This is my use case :
- Create a WebView for http://127.0.0.1
-> from the web site open a popup with a specific url (say
192.168.1.10)
- Create a WebView in the "create" callback
-> from the web site (192.168.1.10) open a popup with a relative url
(say : pouet.html )
- Create a WebView in the "create" callback
==> the new webkitview url is : http://127.0.0.1/pouet.html
Webkit version : 2.4
This is my callback method :
GtkWidget*
create (WebKitWebView *web_view,
gpointer user_data)
{
GtkWidget* result =
webkit_web_view_new_with_related_view(WEBKIT_WEB_VIEW(user_data));
WebKitSettings* settings =
webkit_web_view_get_settings(WEBKIT_WEB_VIEW(result));
g_object_set(settings, "javascript-can-open-windows-automatically", TRUE,
"allow-modal-dialogs", TRUE, NULL);
webkit_settings_set_sans_serif_font_family(settings, "Helvetica Neue");
webkit_settings_set_enable_javascript(settings, TRUE);
webkit_settings_set_javascript_can_open_windows_automatically(settings,
TRUE);
webkit_settings_set_allow_modal_dialogs(settings, TRUE);
webkit_web_view_set_settings(WEBKIT_WEB_VIEW(result), settings);
GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_fullscreen(GTK_WINDOW(window));
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
gtk_widget_realize (window);
GtkWidget* container = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_set_name(container, "tbox");
GtkWidget* closeButton = gtk_button_new_with_label(gettext("Close"));
gtk_widget_set_margin_right(closeButton, 8);
g_signal_connect (closeButton, "clicked",
G_CALLBACK(ast_local_viewer_close_popup), window);
GtkWidget* hTopButtons = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
GtkWidget* hTopButtonsAlign = gtk_alignment_new(1, 0.5, 0, 0);
gtk_container_add(GTK_CONTAINER(hTopButtons), closeButton);
gtk_container_add(GTK_CONTAINER(hTopButtonsAlign), hTopButtons);
gtk_box_pack_start(GTK_BOX(container), hTopButtonsAlign, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(container), result, TRUE, TRUE, 0);
gtk_container_add(GTK_CONTAINER( window), container);
g_signal_connect(result, "ready-to-show", G_CALLBACK(read_to_show), window);
g_signal_connect(result, "close", G_CALLBACK(on_popup_webkit_close),
window);
g_signal_connect(result, "create", G_CALLBACK(create), result);
return result;
}
My question : why the opened url is base on 127.0.0.1 ? How do I change
this behavior to open the popup with the address
http://192.168.1.10/pouet.html
Thx for your help,
Adrien
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-gtk/attachments/20150202/22ca32d5/attachment.html>
More information about the webkit-gtk
mailing list