NoScript has brought this to mainstream browsers for a while.
I believe Chrome and Firefox can be configured to do it without any extensions.