Consider the example where $f=1-t^2$.
To show that the map is not surjective, we can make the following observations.
Let $\sigma:B\to B$ be the unique algebra automorphism such that $\sigma(t)=-t$. Then $A\subseteq B$ is precisely the subalgebra of $\sigma$-fixed elements. Since my $f=1-t^2$ is fixed by $\sigma$, the ideal $(f)$ is $\sigma$-invariant, and therefore $\sigma$ induces an action on $B/(f)$ and the canonical map $B\to B/(f)$ is $\sigma$-equivariant.
The composition $A\to B\to B/(f)$ is then $\sigma$-equivariant and therefore its image is contained in the subset of $B/(f)$ of $\sigma$-fixed elements.
Now the class $\bar t$ of $t$ in $B/(f)$ is not zero ($t$ is a unit in $B$ and $(f)$ is a proper ideal) and it is not fixed under $\sigma$. It follows that $\bar t$ is not in the image of $A$.