Transparent IFrame

Hi, i want my iframe like this:

<iframe width="100px" height="200px" allowtransparency="true" scrolling="no" frameborder="0" src="http://page.aspx"></iframe>

that's the basic code, don't worry about the src. Now inside that page.aspx there is some links like this with no color set, so it's blue.
then when i put this iframe above an black page the blue link does not look good. Any solution on the page.aspx side. i can't change the page that refer to the iframe. so is there an way to keep the colors of links of the page that is requesting the iframe?

i hope i express myself right.
LVL 1
rafaelrglAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

COBOLdinosaurCommented:
I assume the page in the iframe and the main page are not from the same domain in which case the answer is no.  If they are from the same domain it is possible, but we need to see code (the final HTMlL, not the asp).

Cd&
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
Tom BeckCommented:
Here's some javascript that copies all the stylesheets from the parent page to the iFrame page.

http://www.phpied.com/parents-styles-in-an-iframe/

Here's a jquery example.

http://stackoverflow.com/questions/4612374/iframe-inherit-from-parent
0
rafaelrglAuthor Commented:
Sorry for the dalay,

here is the thing about this problem, the iframe is on other domain. So lets say www.domain1.com is using my iframe that is on www.domain2.com. and he put an link to an js script on domain1 that create the iframe tag, so i have an js script on domain1.

now, i tryed both functions on the page you show me tommyboy, but none worked, i think because of different domains, but since i have an js script on domain1. any solution to this:

here is the functios you gave me, none worked for me.

<script type="text/javascript">
window.onload = function () {
  if(window.top && window.top.location.href != document.location.href) {
    var linkrels = window.top.document.getElementsByTagName('link');
    var small_head = document.getElementsByTagName('head').item(0);
    for (var i = 0, max = linkrels.length; i < max; i++) {
      if (linkrels[i].rel && linkrels[i].rel == 'stylesheet') {
        var thestyle = document.createElement('link');
        var attrib = linkrels[i].attributes;
        for (var j = 0, attribmax = attrib.length; j < attribmax; j++) {
          thestyle.setAttribute(attrib[j].nodeName, attrib[j].nodeValue);
        }
        small_head.appendChild(thestyle);
    }
    }
   }
}
</script>

Open in new window

<script type="text/javascript">
window.onload = function() {
    if (parent) {
        var oHead = document.getElementsByTagName("head")[0];
        var arrStyleSheets = parent.document.getElementsByTagName("style");
        for (var i = 0; i < arrStyleSheets.length; i++)
            oHead.appendChild(arrStyleSheets[i].cloneNode(true));
    }
}
</script>

Open in new window

0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

COBOLdinosaurCommented:
You cannot script cross-domain, and that is definitive.  The browsers have specific security provisions that prevent it because of historical hack attacks that can be launched that way.  There is no way for the browser to determine if the scripting is an attack so all cross browser scripting is blocked.

The only solution is for the content of the iframe to be served from the same domain.


Cd&
0
Amandeep Singh BhullarCommented:
I've requested that this question be deleted for the following reason:

Not enough information to confirm an answer.
0
COBOLdinosaurCommented:
The answer I gave is definitive and widely document on EE, on the web, and in the standards specification.  It is commonly known by the majority of web developers.

Check Google

Cd&
0
COBOLdinosaurCommented:
in http:#a37339137

I indicate that it will not work cross domain, and everything that follows confirms that.  A well known reality in web development for modern browsers.

Cd&
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
CSS

From novice to tech pro — start learning today.