Once again, why would you use S/MIME in the browser? It is an insecure environment BY DESIGN. It cannot be made secure. Ever. So stop thinking of S/MIME. Or think through how you would actually secure it. Then realize that it cannot be done.