SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jun 2007
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Using parent styles in IFRAME

    I have an IFRAME where the source is in a different domain to the parent... I can not see or copy the parent document from the IFRAME due to cross browser security (unless someone knows how).

    What I have is this page (a.html):

    PHP Code:
    <STYLE>
    .
    aa_1272 width:325px;  background-colornonepadding3px; }
    .
    aa_table_cells_1272 padding-bottom1pxpadding-top4pxpadding-left3pxpadding-right3pxvertical-align:toptext-align:left; }
    </
    STYLE>
    <
    SCRIPT src="DOMAIN LINK/a.js" type="text/javascript"></SCRIPT> 
    This then dynamically inserts an IFRAME through a script include (a.js):

    PHP Code:
    var a="5";
    document.write('<iframe src="DOMAIN LINK/iframe.php?a='+a+'" height="500" width="350" border="0" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" /></iframe>'); 
    What I thought about doing was grabbing the STYLES and passing them through to the IFRAME like this:

    PHP Code:
    var a="5";
    var 
    styles ".at_table_style_1272 { width:325px;  background-color: none; padding: 3px; }.at_table_cells_1272 { padding-bottom: 1px; padding-top: 4px; padding-left: 3px; padding-right: 3px; vertical-align:top; text-align:left; }";
    document.write('<iframe src="DOMAIN LINK/iframe.php?a='+a+'&styles='+styes+'" height="500" width="350" border="0" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" /></iframe>'); 
    My issue is how can I grab the styles from Javascript and string them together and then assign that to a variable which can then be passed through to the IFRAME?

    If I can do that I can then write that parameter into the HEAD are of the IFRAME and what I am trying to accomplish will work fine.

    Anyone who can assist me get this to work I will pay $50 directly into their PAYPAL account.


    Thanks
    Dan

  2. #2
    Function Curry'er JimmyP's Avatar
    Join Date
    Aug 2007
    Location
    Brighton, UK
    Posts
    2,006
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's probably cos I just woke up but what do you mean about the security stuff?

    I mean, what do u mean by "cross browser security"??

    Your solution looks a bit dirty to be honest (putting all the styles through a query string)...
    James Padolsey
    末末末末末末末末末末末末末末末末末末末
    Awesome JavaScript Zoomer (demo here)
    'Ajaxy' - Ajax integration solution (demo here)

  3. #3
    SitePoint Member
    Join Date
    Jun 2007
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have a good reason... unless you can tell me how my IFRAME (which is in another domain) can access styles that are inline within the parent document.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •