How can empty JavaScript function actually do something?

Posted by OverTheRainbow on Stack Overflow See other posts from Stack Overflow or by OverTheRainbow
Published on 2010-05-19T11:40:51Z Indexed on 2010/05/19 11:50 UTC
Read the original article Hit count: 130

Filed under:

Hello

While trying to understand how a web server worked, I came accross this:

//myfile.js
function donothing(){};

//myfile.html
javascript:donothing(open('http://www.acme.com/whatever.jpg','','left=100, right=0, top=100, scrollbars=no, status=no, titlebar=no, resizable=no, toolbar=no, menubar=no, width=255, height=255'))

I'm no JavaScript expert, so I don't get how an empty function can be made to work. Does someone know?

Thank you.

© Stack Overflow or respective owner

Related posts about JavaScript