Okay so we can get a web page to load into a dhtmlxWindow. But once I click on a link or just move to another page i cannot go back.
I would want to make a simple toolbar with 3 buttons. Previous, Refresh and Next.(maybe a Bookmark ?)
Could you be so kind as to show me the onclick() code i’d have to attach to each button?
How cand i refresh just the page within the dhtmlxwindow and not the whole page?same goes for the prev and next buttons.
And btw you can use this idea and make a full browser toolbar… like the one in the text editor for your future releses.
Hello,
To implement previous,refresh and next buttons you can use some array where window iframe src are placed.
There is onContentLoaded event. It calls when you the iframe content is loaded - so, you can use it to get iframe src:
fl = false;
index = 0;
dhxWins.attachEvent(“onContentLoaded”,function(win){
if(fl) return;
index = arr.length;
arr[index] = win._frame.src;
fl = true
})
To reload the window. You can use the following method:
function loadURL(url){
fl = false;
if(win._iframe) win._frame.src = url;
else win.attachURL(url);
}
function loadURL(url){
fl = false;
if(win._iframe) win._frame.src = url;
else win.attachURL(url);
}
is it win._frame or win._iframe? or are they 2 seperate things?
Sorry for the double post but i was also wondering what variable is fl ?
And it doesn’t work
Here’s my code
i’m just testing the onContentLoaded eventhandler
function zGoogle() {
w4 = dhxWins.createWindow(“w4”, 200, 150, 400, 350);
var bar = w4.attachToolbar();
bar.addButton(“forrward”, 0, “Forrward”, “”);
bar.addButton(“refresh”, 0, “Refresh”, “”);
bar.addButton(“back”, 0, “Back”, “”);
bar.attachEvent(“onClick”, function(id){browsePage(id);});
w4.setText(“Google”);
w4.attachURL(“http://www.google.com/”);
w4.attachEvent(“onContentLoaded”, function(w4){alert(‘testing’);});
}
I just want an alert onContentLoaded but nothing. The toolbar is attached, the URL is attached but no alert nce the page loads or when i go to another page
Sorry… last one… i got it working somehow but arr[index] is always the value that i set with attachURL so it always alerts me the same site - google.com
function zGoogle() {
w4 = dhxWins.createWindow(“w4”, 200, 150, 400, 350);
var bar = w4.attachToolbar();
bar.addButton(“inainte”, 0, “Inainte”, “”);
bar.addButton(“refresh”, 0, “Refresh”, “”);
bar.addButton(“inapoi”, 0, “Inapoi”, “”);
bar.attachEvent(“onClick”, function(id){browsePage(id);});
w4.setText(“Google”);
w4.attachURL(“http://www.google.com/”);
}
index = 0;
var arr= new Array();
dhxWins.attachEvent(“onContentLoaded”,function(w4){
index = arr.length;
arr[index] = w4._frame.src;
alert(arr[index]);
});
Sorry for the double post but i was also wondering what variable is fl ?
It was a typo, sorry for convenience, correct code will be
if(win._frame) win._frame.src = url;
win._frame points to inner content frame
>> i got it working somehow but arr[index] is always the value that i set with attachURL so it always alerts me the same site - google.com
Problem caused by cross-domain security.
It prevents communication between objects, which were loaded from different domains. So, master script can’t access the objects loaded from different domain, including full url of the page, which was set from inside iframe’s content
It prevents communication between objects, which were loaded from
different domains. So, master script can’t access the objects loaded
from different domain, including full url of the page, which was set
from inside iframe’s content
So what you’re saying is that there’s no way i ca do this, i cannot emulate browser behavior inside a window?
Yes, it doesn’t possible to fully emulate browser behavior - because of reason described in the previous answer.