ID:134608
 
I was recently playing around with JavaScript in a BYOND pop-up window, and noticed that window.close() didn't work the way that it's supposed to. I thought about posting this in Bug Reports, but I'm guessing that it was intended to be disabled, and so I decided to: 1) Query as to why it isn't implemented, 2) Request that it be implemented if (1) doesn't have a really good answer.

Hiead
I can't explain exactly why it doesn't function as desired, but I can offer a solution.

In the html document, when you want to close the window set document.location.href="BYOND://?CloseWindow=[the window's name]" to have it pass that back to BYOND as a topic. In your BYOND program, add this to client.Topic:
client/Topic(href,hlist[])
if("CloseWindow" in hlist)
src << browse(null, "window=[hlist["CloseWindow"]]")