Yes and Yes (assuming your random key isn't guessable).
breachattack.com suggests masking the secret with a per-request random key, but masking the user input would work too.
Re:Architecting Websites for the HTTP/2 Era
by nickysielicki on Tuesday May 12, 2015 @05:14PM
(#9534935)
> de-scrambling using JavaScript
No thank you.
A counter-measure then would be to scramble the user input in the page with a random key, and include this key into the page for de-scrambling using JavaScript. It will still efficiently compress the parts of the page which are not user-controlled.