Add favicon to htmlbox

How can I add a favicon to my rhino htmlbox ?

I have tried this in the header but had no luck yet:
<link rel="icon" href="files/favicon.ico" type="image/x-icon">


Hi @Keith1634,

a favicon is usually shown in the adressbar or tab of the browser. The Rhino.HmlBox RhinoScript method in Rhino 5 uses Internet Explorer which is generally capable to display a favicon, however the html box itself does not show an adressbar. Therefore there is no way to use a favicon with above method.

@dale, since it is a Windows.Form behind the scenes i guess, how about adding some argument to use a custom HtmlBox title icon in V6 using:

form.Icon = System.Drawing.Icon(favicon_path)


The HtmlDialog method creates a true HTML dialog.

I doubt its possible to set a ‘favicon’ to an HTML dialog…

Hi Dale,

A bit OT: I was recently looking into using some HTML5 in Rhino HTMLBox method ( specifically Range Slider ) and it did not seem to work. Is there anything that can be done to make use of it in Rhino ?



Sorry - I don’t think I can help with this. But there isn’t any reason it shouldn’t work.

OK thanks Dale, I will try some more then and see if I can make it work. Didn’t work at the first shot so I thought maybe it is something on Rhino method side that would prevent the HTML5 elements from working in HTMLbox…



I think the problem here is Rhino.HtmlBox. Below example shows up fine in IE11 and does only show an empty input field when run through HtmlBox method:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Unbenanntes Dokument</title>
<input id="test" type="range"/> 

@dale, regarding the icon display, i’ve meant the title icon. Not sure if this is possible using the dialog as with standard WinForms.


Hi Clement, yes - I had the same issue - all works fine in the browsers but not in Rhino.HtmlBox, that’s why I was wondering if the HtmlBox method requires any updates to make it work… thanks for testing.


Yea its all a little strange to me. I’ve logged a bug.

– Dale

Hi @Dale,

I can’t seem to get the HTML vbscript window.MoveTo x,y do anything with the Rhino-created HTMLBox - I am trying to have it reposition from Rhino-controlled script. Same with ResizeTo. Is there any reason these would not work in Rhino-created HTML window ?


Hi @Jarek

Rhino.HtmlBox is just a think wrapper around the ShowHTMLDialogEx function. So if it is not working as advertised, there (probably) isn’t anything I can do about it.

– Dale

Hi @Dale,

Thanks - I see the function here
In that case there is probably some limitation with that function. Many other vbscript window-related methods work OK (like window.close or window.setInterval…)

What I am trying to do is to have the HTML box being an UI element to interactively align itself and resize, based on the current Rhino viewport. Using the window.setinterval method and passing RhinoScript object to the HTMLBox, I can have two-way communication between the scripts in Rhino and HTML, sort of event-watcher. But looks like this limitation currently makes repositioning/resizing impossible.

Question/wish - could there be a method called from RhinoScript to set position and size of the Rhino HTMLBox window? I assume it would need to take the window handle as a parameter, and in that case we also may need to HTMLBox method modified so it returns a window handle if successful. Am I going too far or this is a reasonable request ?



I don’t see a way of getting a Window handle - sorry.

– Dale

OK, got it - thanks Dale.

@Clement - I know you did your share of HTMLBox scripting before - did you ever had any luck with resizing/repositioning the modeless dialog programmatically after it was initiated ?



i’ve tried it now in a HtmlBox window which is modeless but had no success to move the HtmlBox window either using window.moveTo(x,y) and window.moveBy(x,y).

The only way i could move a window was when i created my own (from the HtmlBox) but using javascript:

myWindow ='', '', 'width=200, height=200');
myWindow.document.write("<p>Hello World</p>"); 
myWindow.moveTo(100, 100);

sorry, i do not know how to do it using the actual HtmlBox window.

Hi @Clement - thanks for testing and your input.
Interesting to see you can do it with newly open window but I guess we still don’t have a way to pass RhinoScript object to that window to be used to interact with Rhino, right ?


Hi @Jarek, you might try to access the variable from the parent window scope by going through myWindow.opener. But this is only what i remember from javascript, no clue if it works with vbscript inside html.


thanks Clement, I will poke around.