Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6

Thread: Force iFrame

  1. #1
    New to the CF scene
    Join Date
    Jun 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Force iFrame

    I just cant force my iframe to be shown in on parent page when i open direct links. I have tried everything. I got it to the point when direct link opens in parent page but iFrame is empty.

    www.freakcrew.net is the page i wuld like to force iFrame.

    If anyone knows how to do it please help me.

    Thank you

    X-Pr0j3cT

  • #2
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,460
    Thanks
    11
    Thanked 600 Times in 580 Posts
    change the target attribute of your links to the name attribute of your iframe.
    my site (updated 2014/10/20)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.3, IE11:9.2, IE9:2.7, IE10:2.6, FF:16.8, CH:47.5, SF:7.8, NON-MOUSE:37%

  • #3
    New to the CF scene
    Join Date
    Jun 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Main page:

    Code:
    <script type="text/javascript">
    
    loc="info.html"
    
    var str = location.search;
    if(str != ""){
    loc=str.substring(1, str.length)
    }
    
    function load_frame(){
    document.body.style.overflow="hidden"
    document.getElementById('iframe1').src=loc
    }
    </script>
    iFrame Page:
    Code:
    <script type="text/javascript">
    if (self == top){
    var url = self.location;
    self.location = "index.html?" + finepix.html;
    }
    </script>
    Now what do i have to change?
    Last edited by X-Pr0j3cT; 06-18-2008 at 02:53 PM.

  • #4
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,460
    Thanks
    11
    Thanked 600 Times in 580 Posts
    you dont need to change any javascript.

    instead of: <a href="mypage">my page</a>
    use: <a href="mypage" target="frame1">my page</a>

    above considers that your iframe has a name attribute on its tag, set to "frame1"
    my site (updated 2014/10/20)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.3, IE11:9.2, IE9:2.7, IE10:2.6, FF:16.8, CH:47.5, SF:7.8, NON-MOUSE:37%

  • #5
    New to the CF scene
    Join Date
    Jun 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok it seems we dont understand eachother... what i want is that when someone in google searches something and he gets my iFrame page and clicks on it it opens that page without main page.

  • #6
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Try this in the iframe page

    Code:
    <script type="text/javascript">
    if (self == top){
    var url = self.location;
    self.location = "index.html?finepix.html"
    }
    </script>
    and are you running function load_frame() onload?
    The silent one.

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is the one with an idea.


  •  

    Posting Permissions

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