Msg#: 3611766 posted 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://"?
Msg#: 3611766 posted 5:36 pm on Mar 28, 2008 (gmt 0)
Their errors translate in to more work for me if I have to wade through a pool of their 404s because they used relative paths considering it's cross-domain CSS.
Would this be a complicated regex? Would it be difficult to setup some sort of Apache anti-404 script that disallows images to load from my site if the referrer is a cross-domain CSS file? If that were possible I could skip the PHP script altogether possibly. I think off-hand at least.