I used to practice on my acoustic guitar and had a habit of resting my right hand on the bridge while playing individual notes. Now I have switched over to electric guitar in I find it difficult to play without resting my right palm on the bridge. Is it okay to rest the palm on the bridge for electric guitar as I have never seen any one resting their palms on the bridge while playing electric guitars.
When playing single-note lines on electric guitar, especially when using distortion or higher gain, resting the pick hand on the strings lower than the one you are playing can help to eliminate sympathetic tones. These are often caused by the vibration from one string being picked up by another or by small movements such as simply lifting a finger off of a string. Not muting these tones will make your line sound muddy.
Getting used to a position where you are picking 1-2 strings higher than you are muting and learning to shift your hand up and down to move strings can give you a good reference point, which is likely what resting your hand on the bridge is giving you.
As far as I know, it's okay to rest your right palm on the bridge, as long as you don't have a floating bridge (the one with the tremolo where you can push it in both directions). If you have a floating bridge then you shouldn't rest your right palm on the bridge (although palm muting is fine, just don't apply too much pressure) so that the pitch of the note(s) you're playing don't change.
But if you have a 'normal' bridge, then I don't think it's really that bad.
It is true that some methods discourage any type of "anchoring" of the right hand, but in Rock/Blues/Folk/Country and even Jazz styles there aren't a lot of hard and fast rules about hand position (for either hand). What might be a "bad habit" for one style of music could be okay in another.
The main thing is not to develop habits that hurt you physically over time, or affect your sound, or prevent you from executing the techniques you need for your chosen style of music. If you're really laying on the strings heavily, or have the wrist in an unnatural position (bent backward, for example) then it's probably not a good thing.
In acoustic blues playing, it is not unusual have the side of the palm (on the pinky side) resting lightly over the strings where it can be used to get a thumping bass sound.
In electric playing, having the hand in the same position can help with muting, which is a necessity once you get over a certain volume. I think most electric guitar players do some combination of left and right hand muting, so having your hand in that area could turn out to be advantageous.