How do i control the rendering the content in a iframe

I've been asked to integrate a clients site into ours, and we're looking to do this via an iframe - however unfourtunitly we need to overrde some of the CSS styles within the source of that iframe.

Now my requiremnt is simple i.e. I just need to append/if necessary manipulate the content of an iframe.

However i'm getting nothing but problems trying to do this i.e. if i try using javascript i get access denied e.g.

         var method1 = window.frames['uxIframe'].document;
          var iframe=document.getElementById("uxIframe");
          var method2 = iframe.contentDocument;

So my plan b was to use HttpWebResponse / request to stream the info, and this seems to work e.g. please see below... But i can't add it as the contents of an iframe, which is needed otherwise i'll get a number of JS errors?

Is there anyway around this or better yet an alternative approach?

Thanks
P
Dim request As WebRequest = WebRequest.Create("http://www.google.com/")
        ' If required by the server, set the credentials.
        request.Credentials = CredentialCache.DefaultCredentials
        ' Get the response.
        Dim response As HttpWebResponse = CType(request.GetResponse(), HttpWebResponse)
        ' Display the status.
        Console.WriteLine(response.StatusDescription)
        ' Get the stream containing content returned by the server.
        Dim dataStream As Stream = response.GetResponseStream()
        ' Open the stream using a StreamReader for easy access.
        Dim reader As New StreamReader(dataStream)
        ' Read the content.
        Dim responseFromServer As String = reader.ReadToEnd()
 
        'How do i Display the content?
        'uxIframe.InnerHtml = responseFromServer
        'uxIframe.InnerHtml = ""
        'Label1.Text = responseFromServer
        'Literal1.Controls.Add()
 
        ' Cleanup the streams and the response.
        reader.Close()
        dataStream.Close()
        response.Close()

Open in new window

paulCardiffAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

JezcentralCommented:
I don't believe there is a way to do this, for security reasons. An iframe's styles must come from the iframe page itself. You can't impose changes using the containing page. This is to stop people changing pages from other websites. If the page comes from your own website, you must find a way to make the changes to it directly, rather than using the page with the <iframe> tags in.

Is it a page from your own site?

J
0
paulCardiffAuthor Commented:
This page is for a client / supplier - so changing it isn't an option - they've given us permission to this but  its on me now to find a way to do it.

THing is as i'm not looking to change the content rather jsut add to it i'm sure theres someway of doing this?

i.e. sure = Hope :-)
0
JezcentralCommented:
Sorry. It can't be done. Otherwise you can have  have words (or more importantly, prices) disappear, by changing them to match the background.

J
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
paulCardiffAuthor Commented:
What about doing this via custom httphandlers? would that make this possible
0
JezcentralCommented:
Sorry, I don't know about that. I've always worked on the principle that iframes of pages from another site are inviolate. Personally, I'd be horrified if such manipulation were possible. (But then, the internet can be a horrifying place :) )
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.