paulCardiff
asked on
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.getElement ById("uxIf rame");
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
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'].
var iframe=document.getElement
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()
ASKER
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 :-)
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 :-)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
What about doing this via custom httphandlers? would that make this possible
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 :) )
Is it a page from your own site?
J