You would have to break tls to do that. It's your system, you could probably do whatever you want, but the browser is checking for certificates and origin requests. It would get complex real quick to do the same checks the browser is doing...
At that point, you are basically building another browser.