I’m trying to add a default style to every rendered webpage in my browser. I’ve tried many different things and can’t get the DOM to change. I’m using Qt 4.7.0 on Windows with VS. I believe the following should work, but the DOM doesn’t get modified. Any thoughts?

Qt Code:
  1. void QWebView::onLoadFinished(bool error)
  2. {
  3. QWebElement style;
  4. style.setOuterXml("<style>*:focus{outline:1px solid red}</style>");
  5. style.setAttribute("type", "text/css");
  6. page()->mainFrame()->findFirstElement("head").appendInside(style);
  7. }
To copy to clipboard, switch view to plain text mode