iFrame Difficulties

Discussion in 'Scripts, 3rd Party Apps, and Programming' started by somavian, Aug 16, 2012.

  1. somavian

    somavian New Member

    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    I have an iFrame setup and it works fine with local pages, but not any external pages. Is there a feature blocking that on x10hosting? I didn't think it was against the terms of service, but am I wrong?
     
  2. descalzo

    descalzo Grim Squeaker Community Support

    Messages:
    9,375
    Likes Received:
    327
    Trophy Points:
    83
    Got URL or code we can look at?
     
  3. somavian

    somavian New Member

    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    var query = document.location.search.substring(1);
    var params = query.split('&');
    var url = params[0].split('=');
    alert(url);
    document.write('<iframe id="displayFrame" frameborder="0" width="' + (screen.availWidth - 34) + '" height="' + GetHeight() + '" src=' + url[1] + '></iframe>');

    The alert prints the url properly (http:\\www.google.com for example) and again, it works with internal pages (like index.php).
     
  4. essellar

    essellar Community Advocate Community Support

    Messages:
    3,295
    Likes Received:
    227
    Trophy Points:
    63
    To answer the main question, no, there is no feature blocking iframe content unless you put it there yourself (bust-out code, referer-based .htaccess restrictions, that sort of thing).

    You may, however, be running into difficulties with relative URLs or same-source restrictions in the browser. As descalzo pointed out, a URL or code to look at would be nice. (Preferably both, since many of the sorts of problems that can arise can't really be spotted by viewing the page source, and it helps to see if your code is actually resolving to the values you expect in the browser.)
     
  5. descalzo

    descalzo Grim Squeaker Community Support

    Messages:
    9,375
    Likes Received:
    327
    Trophy Points:
    83
    Try it with a different external URL. Pretty sure that Google does not want to be put in iframes and has code to blank itself out if you try.
     
  6. somavian

    somavian New Member

    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    You're right again, thanks. I had tried a few and none of them liked it, but I finally got smart enough to try another one of my sites and that worked.
     
  7. descalzo

    descalzo Grim Squeaker Community Support

    Messages:
    9,375
    Likes Received:
    327
    Trophy Points:
    83
  8. misson

    misson Community Paragon Community Support

    Messages:
    2,572
    Likes Received:
    72
    Trophy Points:
    48
    To add to the other comments about including code, proper sample code (complete, concise, representative) should accompany every development question. See the links in my sig for more guidelines.

    Please use
    PHP:
    , [html] or [codetags (as appropriateto separate and format code.
     

Share This Page