Question:
Apply CSS across domains?
wyntre_2000
2007-08-27 10:52:13 UTC
I was wondering if it is possible to link to a CSS file across domains without security/cross browser issues.

Here is the setup: Manage one primary site on Domain A with secondary content on Domain B. Both sites use same layout/design. I have direct control over Domain A, but changes to Domain B require a third party to implement.

I would like to have immediate control over the stylesheet and wass thinking about having the CSS file on Domain B be a hard link to the file on Domain A.

So instead of the LINK tag on Domamin B being a relative link to the finle on Domain B, its a URI to the file on Domamin A.

Any issues I should be concerned with?
Three answers:
fjpoblam
2007-08-27 11:01:05 UTC
I do it on mine...link rel="stylesheet" href="..., with the url being absolute instead of relative



I've bumped into myself through my own stooopidity a few times, though, by updating the css for one website without remembering the impact it'll have on the other!



And remember, it'll slow down the load time, because the server has to go out and contact the css web server on the other website to fetch the css file at least once.
Adrian Godong
2007-08-27 11:00:10 UTC
Just make sure that you can access the file from Domain B (shouldn't be a problem if you can access Domain A CSS URL from outside the hosting company network).



And no, I don't think there are any security consideration.



If you're using someone else's CSS, that's another problem.
2007-08-27 11:01:34 UTC
No issues I can think of. All it's doing is loading the CSS file into the other site. Have done this myself and it worked fine n dandy. Just be careful if you're using free hosting or whatever sometimes they have hotlink protection and might see it as your other site hotlinking your pages. Probably not though.. so link away!


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...