Load Webpage in a window or dialog

Get help with using Metro 4 components
Post Reply
r3mi
Posts: 1
Joined: Thu Dec 20, 2018 11:43 am
Status: Offline

Load Webpage in a window or dialog

Post by r3mi » Thu Dec 20, 2018 11:59 am

Hello I am building an admin dashboard for my product. I am having trouble calling a url other than youtube in a window.
I want my webpage to load immediately the create...() function is called.

function createWindowFBPage(){
Desktop.createWindow({
width: 500,
icon: "<span class='mif-facebook'></span>",
title: "Facebook",
content: "",
onShow: function(_dialog){
$.ajax({
url: "https://www.facebook.com/",
dataType: "html",
success: function(result){
var html = result;
$.Dialog.content(html);
}
});
}
clsContent: "bg-dark"
});
}

User avatar
olton
Site Admin
Posts: 196
Joined: Mon Apr 09, 2018 6:19 pm
Location: Kiev, Ukraine
Status: Offline

Post by olton » Thu Dec 20, 2018 1:59 pm

At this time dialog has a minor problem with event onShow. But you can use next method:
https://sandbox.org.ua/olton/code/j1Rbaevbd8

P.S.
To load facebook page, you must use an iframe, because of you receive X-Cors error otherwise.

P.S.2
https://metroui.org.ua/dialog.html# Read the dialog docs. You use syntax from Metro UI 3, but in Metro 4 dialog component was rewritten.

User avatar
olton
Site Admin
Posts: 196
Joined: Mon Apr 09, 2018 6:19 pm
Location: Kiev, Ukraine
Status: Offline

Post by olton » Fri Dec 21, 2018 6:49 pm

Hi! I fix onShow event in the develeop branch 4.2.32
https://sandbox.org.ua/olton/code/yExZ0D9ZP2

Post Reply