There are a couple of different approaches you can take but, both require that you be there by his side. The first is re-direction: feeding very small treats in the face of those distractions. Basically, teaching him that good things happen in their presence and changing his attitude toward them in the process. The 2nd one is to step between him and the window. Make him back-up a small step or two. You're trying to show him it's not his window/property to defend....it's yours and you are handling it. Make him back off, lay down and give lots of praise. Both methods require lots and lots of practice everytime it happens.