Webdialog: set_url and write html in a file? how?
-
Hi all, I', not able to write the html loaded in a webdialog after I set its url:
dlg = UI::WebDialog.new("mionome", false, "altro")
url = "http://www.miosito.com"
dlg.set_url(url)now I want to copy the html of the dlg in a file.txt without show the dialog??
any help??
Thanx!!
-
WebDialog doesn't give you access to the HTML content.
And in addition I think there might be platform issues. Under OSX the website is loaded when you set_url, set_file, or set_html - before the dialog is displayed. (if I remember correctly.)
Under Windows it doesn't happen until you display the webdialog.From what I gather - what you really want to do, is not display a webdialog, but get the content of a webpage?
-
any ideas?
maybe javascript can help me? -
(Re)looking in the documentation of SU API I found theget_element_value method, used to get a value, with a given element_id, from the web dialog's DOM. So I think I can access to the html of the page......
-
@bomastudio said:
(Re)looking in the documentation of SU API I found theget_element_value method, used to get a value, with a given element_id, from the web dialog's DOM. So I think I can access to the html of the page......
Only works when the dialog is visible.
-
Add this piece of javascript to your html
Should trigger when the dialog is fully loadedwindow.onload = function() { window.location.href ='skp;start@'; }
-
@brett mcallister said:
Add this piece of javascript to your html
Should trigger when the dialog is fully loadedwindow.onload = function() { > window.location.href ='skp;start@'; > }
But that triggers when all external CSS and images are loaded. I find it better to use the DOM event that triggers when the DOM tree is ready.
-
@thomthom said:
But that triggers when all external CSS and images are loaded. I find it better to use the DOM event that triggers when the DOM tree is ready.
Which is..?
-
@brett mcallister said:
Add this piece of javascript to your html
Should trigger when the dialog is fully loadedwindow.onload = function() { > window.location.href ='skp;start@'; > }
Please excuse me as I'm not precise in my posts..... I have to use a web service: I must use a URL and the server send me a xml file (I used my btrrowser so I don't recognize that the web page was, in reality, a XML code..... forgive me.....
So now the question is: do you think is better to download that file in anyway or to process it in a webdialog (like I was trying....)?
-
@jim said:
@thomthom said:
But that triggers when all external CSS and images are loaded. I find it better to use the DOM event that triggers when the DOM tree is ready.
Which is..?
https://developer.mozilla.org/en/DOM/DOM_event_reference/DOMContentLoaded
Though I just use jQuery these days - makes everything so much easier.
-
I've just used the wget.exe tool. And it works!! But I had some trouble with the system command....
Advertisement