kn0wl3dg3 Posted July 12, 2011 Share Posted July 12, 2011 Is there a way to inject css into a website? Here's the scenario: We contract with a vendor to get part of our offerings. They did a redesign, and we don't like the new background color. We asked, and they said they can't change it because it would change it for every client. So we asked if we would be ok finding a way to inject a new bg color into the css, they said sure, which leads me here. Is there a way to do this? All I want to do is change the background color for our users. Hope this makes sense. Any ideas/help is appreciated. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/241817-inject-a-css-file/ Share on other sites More sharing options...
cssfreakie Posted July 12, 2011 Share Posted July 12, 2011 Keep in mind that there are 3 ways to apply css [*]An external stylesheet [*]between style tags [*]as inline style In this order style can be overwritten. So yes you can easily change the style. I understand what they say, but if they serve there clients like you should they could have atleast mentioned the stuff above. On the other hand any book you would read about css, will mention that within the first 10 pages. Quote Link to comment https://forums.phpfreaks.com/topic/241817-inject-a-css-file/#findComment-1241973 Share on other sites More sharing options...
kn0wl3dg3 Posted July 12, 2011 Author Share Posted July 12, 2011 Keep in mind that there are 3 ways to apply css [*]An external stylesheet [*]between style tags [*]as inline style In this order style can be overwritten. So yes you can easily change the style. I understand what they say, but if they serve there clients like you should they could have atleast mentioned the stuff above. On the other hand any book you would read about css, will mention that within the first 10 pages. Thanks. I'm well aware of the types off css and they're rules about precedence. My question is how to inject mine into someone else's. Maybe I don't understand your response though Quote Link to comment https://forums.phpfreaks.com/topic/241817-inject-a-css-file/#findComment-1241982 Share on other sites More sharing options...
cssfreakie Posted July 12, 2011 Share Posted July 12, 2011 well your description is a bit unclear to be honest. Where does this piece of software run, are you able to alter it? or are you able to add for instance javascript in it. we have no idea what this piece of software is where it is run, which is allowed, do you run it in an iframe et cetera. We have no idea and so we can't say anything more than that. Quote Link to comment https://forums.phpfreaks.com/topic/241817-inject-a-css-file/#findComment-1242010 Share on other sites More sharing options...
kn0wl3dg3 Posted July 13, 2011 Author Share Posted July 13, 2011 well your description is a bit unclear to be honest. Where does this piece of software run, are you able to alter it? or are you able to add for instance javascript in it. we have no idea what this piece of software is where it is run, which is allowed, do you run it in an iframe et cetera. We have no idea and so we can't say anything more than that. I thought it was. Oh well. I want to alter someone's css but only for users coming from my site. It comes from a vendor who we asked all those questions and no, we can't make any changes. But as I explained, we got permission to try a hack if it doesn't mess anything up. The answer to the last question is no, we're doing a pass through single sign on right now, where we just pass them over to their site with credentials. My one idea was an iframe, but I know for a fact that they have all kinds of tracking stuff in there so I need to make sure there would be no residual harm in doing it that way. I can't see any, but they are tight-lipped as to how they do what they do, and I'm waiting on a response if they think that would be an option. They have been notoriously hard to work with in the respect of changing things, and I have no say in using the vendor or not, so I need to find a way around them. I just need other ideas Thanks Quote Link to comment https://forums.phpfreaks.com/topic/241817-inject-a-css-file/#findComment-1242180 Share on other sites More sharing options...
cssfreakie Posted July 13, 2011 Share Posted July 13, 2011 you could maybe provide the vendor with some solution, which if i were them have already used. A very simple example. <?php if(isset($_GET['user'])){ $url = basename($_GET['user']).'.css'; //probably want to set this as a session variable to allow it to be used between pages. echo '<link type="text/css" rel="stylesheet" href="css/'.$url.'" />'; } // in a real life example you might want to add an ifclause to see if the file really exists before including it. ?> If you place that in the <head> and the a client get redirected as folows http://www.domain.com/index.php&user=1234 An stylesheet is loaded with the name of 1234.css and other iwise if you use an iframe use javascript to alter the css. Quote Link to comment https://forums.phpfreaks.com/topic/241817-inject-a-css-file/#findComment-1242212 Share on other sites More sharing options...
kn0wl3dg3 Posted July 13, 2011 Author Share Posted July 13, 2011 That might be a good option. I'll have to find out what language their system is in (if they'll tell me ) Going to look into those suggestions. Thanks. If anyone thinks of anything else, let me know. Quote Link to comment https://forums.phpfreaks.com/topic/241817-inject-a-css-file/#findComment-1242230 Share on other sites More sharing options...
teynon Posted July 13, 2011 Share Posted July 13, 2011 Can you show us the output of your page, or link to the relevant page? That way we know how they are using their css and what not? Quote Link to comment https://forums.phpfreaks.com/topic/241817-inject-a-css-file/#findComment-1242297 Share on other sites More sharing options...
kn0wl3dg3 Posted July 13, 2011 Author Share Posted July 13, 2011 Can you show us the output of your page, or link to the relevant page? That way we know how they are using their css and what not? Access is not something that can happen, its something that doesn't face outward, its purchased by the head and regulated. What I can do first thing in the morning is to grab a screenshot and grab some of their html if that would help. Thanks for the response Quote Link to comment https://forums.phpfreaks.com/topic/241817-inject-a-css-file/#findComment-1242478 Share on other sites More sharing options...
teynon Posted July 13, 2011 Share Posted July 13, 2011 You can't just send an address to the website? Quote Link to comment https://forums.phpfreaks.com/topic/241817-inject-a-css-file/#findComment-1242485 Share on other sites More sharing options...
kn0wl3dg3 Posted July 14, 2011 Author Share Posted July 14, 2011 You can't just send an address to the website? The live site is not up yet, so I would only be able to show you a demo. This is far as I can get anyone in: http://wpocmhra.convergencehealth.com/Default.aspx?tabid=3908&caltid=wpo163444738&nrcun=wpo163444738&nrcpw=wpo163444738 All I want to do is get rid of the hideous blue background. It doesn't match our scheme and sticks out like a sore thumb. They won't change anything so I'm trying to find a way around it. Thanks for reading Quote Link to comment https://forums.phpfreaks.com/topic/241817-inject-a-css-file/#findComment-1242752 Share on other sites More sharing options...
Clarkeez Posted August 4, 2011 Share Posted August 4, 2011 Well that is ASP NET not PHP so cssfreakies solution wouldn't work :/ Quote Link to comment https://forums.phpfreaks.com/topic/241817-inject-a-css-file/#findComment-1252200 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.