Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/241817-inject-a-css-file/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/241817-inject-a-css-file/#findComment-1241973
Share on other sites

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  :shrug:

Link to comment
https://forums.phpfreaks.com/topic/241817-inject-a-css-file/#findComment-1241982
Share on other sites

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.

 

 

Link to comment
https://forums.phpfreaks.com/topic/241817-inject-a-css-file/#findComment-1242010
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/241817-inject-a-css-file/#findComment-1242180
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/241817-inject-a-css-file/#findComment-1242212
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/241817-inject-a-css-file/#findComment-1242478
Share on other sites

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.  :D 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

Link to comment
https://forums.phpfreaks.com/topic/241817-inject-a-css-file/#findComment-1242752
Share on other sites

  • 3 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.