Your first reaction is usually panic and fear; and the cat feels that along with excitement and adventure and all kinds of other feelings. All of this usually takes place in a split second so you have to act fast so that you can get control of yourself and your kitty cat.
After having indoor only cats for years I have noticed that if they do not go outside on a regular basis and are broken of the habit or if they are only allowed out on a deck or patio; cats usually adapt pretty well if you are consistent with them. It is much harder if you are not the only person who oversees the family cat and they get inconsistent treatment or discipline from different members of the household. This can take place not because someone thinks the cat should be able to get outside on this particular morning, but because someone is in a hurry, and not paying enough attention to keep up the training regarding the cat. And, yes, cats can sense that, they are clever, especially if there number one goal that day is to run out the door with the rest of the family.
Of course that brings up the next point in the training; trying to get the cat to think that it does not want to run outside. Because that is the essence of getting rid of this behavior, having your cat see the door open and he or she doesn’t even want to get up to come and see what’s on the other side. There are some points to ponder to undo the positive thoughts or just a natural instinct your cat has to run for their lives out into the unknown:
Don’t have a bird feeder, etc. right by the door or in any place where the cat is going to immediately see and smell and sense a lot o fun, if they can just get over this foot in the way.
Pick a time when you can control the situation and there will be no one else there to distract the training. Let the cat only get so far in his escape; then either try to make a loud noise they don’t like, or a smell they hate, you can squirt them with water or do something they are negative about and let them run back in the house. Keep repeating this until the cat feels negative about the experience of attempting to run out the door. Even though this sounds like it is going to make your cat unhappy, that is not your issue right now; you would be very hurt if you lose your pet companion or if they got run over by a car, etc.