Results 1 to 5 of 5

Thread: HTML Include?

  1. #1
    Join Date
    May 2008
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default HTML Include?

    I'm looking for something in javascript that would include an html file from another server/address into the code of the webpage only displaying the html and not the javascript so that any links are followable by search engines.

    I know something like this exists because there are scripts in this forum for such a thing but all the script links in those threads are broken.

    Thanks in advance.

  2. #2
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,319
    Thanks
    30
    Thanked 136 Times in 131 Posts
    Blog Entries
    29

    Default

    Can you tell me which script links are broken? I know there was a problem, but that's solved now.

    Anyhow, if you want to include foreign HTML, you have to use iframes. You could do something like this:
    Code:
    <a href="#" onclick="inserted=document.getElementById('SomeDiv'); 
    inserted.style.position='relative'; inserted.style.width='70%'; inserted.style.height='70%';
    inserted.style.left='10px'; inserted.style.top='20px'; inserted.innerHTML='<iframe src=\'http://www.google.com\' frameborder=\'no\' style=\'width:40%;height:40%;\'></iframe>'; return false">Google</a>
    
    <div id="SomeDiv"></div>
    or replace the appropriate parts of the lines above with css / javascript-functions.
    ===
    Arie Molendijk.
    Last edited by molendijk; 07-20-2008 at 09:26 PM. Reason: Correction

  3. #3
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,319
    Thanks
    30
    Thanked 136 Times in 131 Posts
    Blog Entries
    29

    Default

    There's also this solution, of which the following is an application:
    Code:
    <head>
    
    <style type="text/css">
    a{font-family:verdana; font-size:12px}
    #google{position:relative; left:50px; height:280px;width:500px; overflow:auto; border:1px dashed red; display:none}
    </style>
    
    <script type="text/javascript" src="http://codinginparadise.org/projects/purple-include/purple-include.js"></script>
    
    </head>
    
    <body>
    
    <a href="#" onclick="document.getElementById('google').style.display='block'; return false">Google</a>
    
    <div id="google" href="http://www.google.nl#xpath(//html)"></div>
    
    </body>
    .
    ===
    Arie.

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    The OP said (or so I understand) 'not Javascript, so that the links can be followed by search engines'. In which case, I'm afraid, you are out of luck. No such solution exists at this time. If you're using XHTML (proper XHTML, dropping IE support) you can use XIncludes, but support for XIncludes is, at the time of writing, sparse.

    Arie, that's very bad scripting. :-\
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,319
    Thanks
    30
    Thanked 136 Times in 131 Posts
    Blog Entries
    29

    Default

    Quote Originally Posted by Twey View Post
    Arie, that's very bad scripting. :-\
    I know. Just a quick way to show how to get Google in a div without (i)frame.
    ===
    Arie.

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
  •