Javascript - Declare Domain persistent CSS or JS
Currently we have a local network(intranet) set up with about 40,000 directional html files not following any file layout what so ever. Some files contain no headers while others contain no bodies others contain custom scripts and so on.
My issue is that all of these files have no styling what so ever. They have default styles 开发者_开发百科with no trademarking or colors. I would like to apply some basic styles to these pages.
The Gotchas
We can't use iframes because it messes up the bookmarking system and I do not intend to edit the files individual or with a batch script due to the amount of files. Also I do not want to change the headers output.
Conclusion
So is there any way to declare domain persistent styles/scripts for a domain sort of like a cookie. Browser specific code is fine considering we can talk the users(on the intranet) into using ie,firefox, or google chrome if they want the styles. If the user needs to visit an initial page to set up the styles for that domain that is ok. I do not want any plugins installed because the users do not have admin access.
Hidden or outdated tecnologies are ok like VBscript in IE are some hidden features in firefox like Chris blogged about http://css-tricks.com/using-css-without-html/.
EDIT: We ended up using user/browser styles. Not perfect but acceptable.
There is no standard or protocol for sharing stylesheets like that. Your only real option other than editing all the files is to transform the requests on-the-fly using a transparent proxy. Essentially you would have the proxy intercept the requests, tidy the HTML (to ensure there is at least a head tag), then inject a stylesheet link.
If you really want to go down the path of managing each user's browser (NOT recommended!) then I would suggest looking into the "user styles" feature of Firefox or a script engine like GreaseMonkey
精彩评论