I am showing you a very basic way to do it. Here I am assuming that B is directly accessible from A. There may be variations according to various situations.
On A:
ssh -D socks_port B
This will open up the port socks_port on A as a SOCKS proxy.
On your system:
ssh -L local_port:localhost:socks_port A
This will forward local_port on your system to port socks_port on A.
Then you can configure your browser to use SOCKS proxy on socket localhost:local_port
A one-liner would look like this:
ssh -t -L 1234:localhost:5678 FIRSTHOST ssh -D 5678 SECONDHOST
where FIRSTHOST and SECONDHOST have to be replaced by your hosts’ names or IP addresses.
In your browser you have to enter a socks proxy as:
localhost:1234