Injecting CSS rules into the page in Android Browser
问题 I'm writing a JavaScript to inject a new CSS rule into pages in Android browser in order to display some text in a custom CSS font (after some replacement). Here is how I tried to inject the CSS rule: var css = '@font-face {font-family:"font"; src:url(http://www.example.com/font.ttf);} si{font-family:"font"}'; if(document.getElementsByTagName("style")[0]){ var style = document.getElementsByTagName("style")[0]; } else { var style = document.createElement("style"); style.type = "text/css";