1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

omg, I feel so stupid for asking this html question...

Discussion in 'HTML & JavaScript' started by Indiigo007, Apr 26, 2012.

  1. Indiigo007

    Indiigo007 Junior Member

    Joined:
    Nov 11, 2009
    Messages:
    189
    Likes Received:
    191
    Location:
    Los Angeles
    If I want to use example.com to show the entire contents of www.google.com -- as if you were AT google.com except it says www.example.com in the address bar (and I could add info in the header) -- what code would I need to accomplish this on example.com.

    Basically a frame that is 100% of the browser.

    Why can't I figure this out?!? Thanks to anyone that can help.
     
  2. lancis

    lancis Elite Member

    Joined:
    Jul 31, 2010
    Messages:
    1,632
    Likes Received:
    2,384
    Occupation:
    Entrepreneur
    Location:
    Milky Way
    Home Page:
    Code:
    <iframe src="http://www.google.com"></iframe>
    
     
    • Thanks Thanks x 1
  3. Indiigo007

    Indiigo007 Junior Member

    Joined:
    Nov 11, 2009
    Messages:
    189
    Likes Received:
    191
    Location:
    Los Angeles
    I appreciate your help, but no.
     
  4. partymarty4870

    partymarty4870 Elite Member

    Joined:
    Jul 7, 2010
    Messages:
    2,034
    Likes Received:
    1,690
    Location:
    I come from a land downunder
    Code:
    <body>
    <p><iframe name="I1" width="100%" height="100%" src="[URL]http://www.the-big-G.com/[/URL]">
    This is 2012, get a new browser already!
    </iframe></p>
    </body>
    
    that should do it.
     
    • Thanks Thanks x 1
  5. nytrolic

    nytrolic Registered Member

    Joined:
    Oct 7, 2008
    Messages:
    86
    Likes Received:
    35
    Do it with PHP

    PHP:
    $url "http://www.example.com";
    $str file_get_contents($url);
    echo 
    $str;
    Or

    PHP:
            function get_url_contents($url){
                
    $kurl curl_init();
                
    $timeout 10;
                
    curl_setopt ($kurlCURLOPT_URL,$url);
                
    curl_setopt ($kurlCURLOPT_RETURNTRANSFER1);
                
    curl_setopt ($kurlCURLOPT_CONNECTTIMEOUT$timeout);
                
    $results curl_exec($kurl);
                
    curl_close($kurl);
                return 
    $results;
            }
            
            
    $url "http://www.google.com";
            echo 
    get_url_contents($url);
     
    • Thanks Thanks x 1
  6. Brottaren

    Brottaren Newbie

    Joined:
    Apr 29, 2012
    Messages:
    17
    Likes Received:
    1
    I'd use file_get_contents or Curl, as said above. It's not very hard either, just google some and you'll find out how to do it :)
     
  7. ndks~

    ndks~ Newbie

    Joined:
    Jan 10, 2012
    Messages:
    26
    Likes Received:
    3
    Location:
    SYD, Australia
    I'm not sure about Iframing G$$gle because they have some heavy duty restrictions on iframes.

    However if you are trying to set the height of an element to 100%, embed jquery in your page and then put this in script tags in your head:
    Code:
    var windowHeight = $(window).height(); 
    $(window).load(function(){
        $('.className').css({'height':(windowHeight) + 'px'});
    });
    $(window).resize(function(){
        var windowHeight = $(window).height(); 
        $('.className').css({'height':(windowHeight) + 'px'});
    });
    
    Reason being is that browsers don't consider 100% as being a valid height value, unless the element is inside a parent element that already has a defined height. Annoying stuff sometimes. Also you probably want to set the padding to 0px for the element with css.

    Hope this helps (somehow)
     
    Last edited: Apr 30, 2012
  8. roster67

    roster67 Registered Member

    Joined:
    Mar 27, 2012
    Messages:
    69
    Likes Received:
    10
    Its not possible to do what you are wishing with iFrame!
     
  9. Zapdos

    Zapdos Power Member

    Joined:
    Oct 22, 2011
    Messages:
    597
    Likes Received:
    708
    Location:
    Eastern North Carolina
    Depends on the site.

    Iframing major websites is likely not possible as it is possible for an iframed website to remove itself from being iframed. Many major websites incorporate this.
    Using a fetch request on certain sites is also not possible, like google. After a certain amount of requests in a short period you will be considered a bot.

    Iframing is however the best choice if its possible to do. Cookies are stored locally on the users machine whereas with a fetch request you will need to create a database to store the session.