Page is a not externally linkable
- Code, Content, and Presentation
-- PHP Server Side Scripting
---- Detect relative paths in a linked CSS stylesheet?


JAB_Creations - 1:08 am on Mar 27, 2008 (gmt 0)


I'm considering the option of allow people to add a URL to an external style sheet so they can adjust how my site appears when they visit. However if I did so I want to prevent those stylesheets from using relative paths to files such as background-images and cursors as some browsers do not correctly interpret relative paths. I would also require the absolute paths not to encase URLs in single or double quotes for backwards compatibility (my site tentatively supports IE on OSX for example). I essentially want to prevent 404s coming from other people by enforcing the rule via PHP.

So is it possible to access an external CSS file and determine if there are any relative paths based on the required rule that if a line contains the string "url" it must match "url(http://"?

- John


Thread source:: http://www.webmasterworld.com/php/3611766.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com