We’ve all been on Web sites and received the „Invalid input, please try again“ alert and the „Delete record. Are you sure?“ confirmation dialog. Developers often want to pop up informational messages like these.

Sidebar, however, has disabled these JavaScript functions. Using popup dialogs goes against the Windows Vista UX guidelines for Sidebar gadgets. If you still feel compelled to use popups, you can emulate these functions.

To do this, first insert a simple one line tag into the head element of your HTML:

<script src="alert.vbs" type="text/vbscript"></script>

Then create a file that contains the following code and name it alert.vbs. Now you can continue to use alert and confirm as you wish.

‘simulate JavaScript alert() function
sub alert(prompt)
      MsgBox prompt, 48 , "Sidebar Gadget"
end sub  

‘simulate JavaScript confirm() function
function confirm(prompt)
      dim res
      res = MsgBox (prompt, 33, "Sidebar Gadget")
      if res=1 then
          confirm = true
      else
          confirm = false
      end if
end function


via Gadgets: Build Your Own Windows Vista Sidebar Gadget.