Follow us on...
Follow us on Twitter Follow us on Facebook
Register
Page 1 of 2 12 LastLast
Results 1 to 8 of 14
  1. #1
    HateEternal is offline Mac Metal Head
    Join Date
    Nov 2003
    Posts
    821
    Thanks
    0
    Thanked 1 Time in 1 Post

    Loading external pages/seperate pages in a div

    Is there anyway, through javascript and the DOM (or any other way) to load any specified html file into a div, so in a way the div is used like a frame would be?

    I am just trying to find a way to replace frames with divs alone. I know how to set a div's HTML through javascript but I don't know how to load any external html. I have been searching and have not yet found a way. I expect that if there is a way, it is ugly and not worth it.

    Let me know if you have a way to do it, its probably more of geek wanting to know how something works more than practical use.

  2. #2
    mrfluffy's Avatar
    mrfluffy is offline OmniWeb Convert
    Join Date
    Dec 2001
    Location
    Hants UK
    Posts
    346
    Thanks
    0
    Thanked 0 Times in 0 Posts
    xmlhttprequest can load html (porbably not a whole page though cos there'd be 2 body/head tags) into a div, Apple have a tutorial - http://developer.apple.com/internet/...mlhttpreq.html

    and I'm working on a web-based Delicious Library which uses it - http://www.dottom.co.uk/library/ (really not finished)
    PowerBook G4 1.25Ghz, 15", 1GB, 80GB,SuperDrive, 10.4
    MacMini, 1.25Ghz G4, 256MB (will be upgraded), 80GB, Combo Drive, 10.4
    20GB iPod (4G)
    eMate 300, Newton OS 2.1, Bluetooth
    Newton MessagePad 2000, Newton OS 2.1, WiFi, Bluetooth
    NeXT Turbo Colour, NeXTStep 3.3
    TomPhippen.com
    dogtanian.net

  3. #3
    andehlu's Avatar
    andehlu is offline this modern love
    Join Date
    Feb 2004
    Location
    torontoCANADA
    Posts
    244
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i wish this could be done easilly. The only way is to have an iframe within the div tag thgen target that iframe....

  4. #4
    HateEternal is offline Mac Metal Head
    Join Date
    Nov 2003
    Posts
    821
    Thanks
    0
    Thanked 1 Time in 1 Post
    Quote Originally Posted by mrfluffy
    xmlhttprequest can load html (porbably not a whole page though cos there'd be 2 body/head tags) into a div, Apple have a tutorial - http://developer.apple.com/internet/...mlhttpreq.html

    and I'm working on a web-based Delicious Library which uses it - http://www.dottom.co.uk/library/ (really not finished)
    cool, I'll give it a try. it shouldn't be a problem with the 2 body/head tags. Worst case I'll just leave the head and body tags off my dynamic content.

  5. #5
    Cat's Avatar
    Cat
    Cat is offline Registered User
    Join Date
    Jan 2003
    Location
    @ my Mac
    Posts
    1,972
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Perhaps this is a stupid question, but is there any reason not to use PHP? It may depend on what exactly you are trying to achive and PHP may not be the best solution, but anyway ...
    Code:
    <?php include "filename"; ?>
    This is not a signature (but I could be wrong).
    15" MacBook Pro C2D@2.4 GHz | 2 GB RAM | Mac OS 10.5.4 |
    Website | LinkedIn | Publications
    GP/O d-(+)@ s: a->? C++(+++) U* P+ L+>++ !E---- W+++ N o? K? w--- O? M++ V? PS+++ PE-- Y+ PGP t 5? X- R !tv b++++ DI+(++)@ D+(++) G++(+++) e+++$>++++$$ h--->---- r+++ y++++@

  6. #6
    HateEternal is offline Mac Metal Head
    Join Date
    Nov 2003
    Posts
    821
    Thanks
    0
    Thanked 1 Time in 1 Post
    Quote Originally Posted by Cat
    Perhaps this is a stupid question, but is there any reason not to use PHP? It may depend on what exactly you are trying to achive and PHP may not be the best solution, but anyway ...
    Code:
    <?php include "filename"; ?>
    Ok, so you know how iframes work? So say I made a website with a content frame and a navigation div. When I click on a link in the nav it opens the new page in the iframe. I want to be able to do the same thing but only using divs. You can make scrollable divs, which is not a problem, but I don't know how to load html from a separate file in the div if a link is clicked. So it would be functionally the same as using an iframe... but not using an iframe. Biggest benefit is that I can make pages for my class that validate strict and still have the same functionality.

  7. #7
    mdnky's Avatar
    mdnky is offline [Bobs/Prog/Design:~] mod%
    Join Date
    Jul 2001
    Location
    Baton Rouge, LA - USA
    Posts
    2,676
    Thanks
    0
    Thanked 5 Times in 5 Posts
    Quote Originally Posted by HateEternal
    Ok, so you know how iframes work? So say I made a website with a content frame and a navigation div. When I click on a link in the nav it opens the new page in the iframe. I want to be able to do the same thing but only using divs. You can make scrollable divs, which is not a problem, but I don't know how to load html from a separate file in the div if a link is clicked. So it would be functionally the same as using an iframe... but not using an iframe.
    You'd have to use a few different methods combined for it to work. The PHP include for the content, and JS for the links to know which to use.

    You're probably better off in the long run keeping it more 'traditional' as separate pages. That'll go better towards standards compliance and accessibility/usability.
    .
    | My Homepage | Restore the Pledge |

    • MacBook Pro i7 2.66GHz 15" HD matte, 4GB, 500GB 7200RPM, OS X 10.6
    • MacBook Pro Core2Duo 2.33GHz 15" matte, 2GB DDR2 RAM, 500GB 7200RPM, DL Superdrive, OS X 10.6
    • Apple 23" Cinema HD Display, Apple Slim-Alum Keyboard, Apple BT Alum Keyboard, Magic Mouse
    • iPhone 4, iPhone 3G, iPhone 8GB, iPod Nano 16GB, iPod Photo 30GB, Nikon D50, Nikon L6, Epson 3490, Epson R1800, OkiData C5500N


  8. #8
    andehlu's Avatar
    andehlu is offline this modern love
    Join Date
    Feb 2004
    Location
    torontoCANADA
    Posts
    244
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i think he wants to make divs load external documents without complete page reload, is this right hateeternal? If so, this cannot be done, you need to have an iframe the dimensions of your div and target the iframe in the nav. You will be able to still hide and show the div's with JS. But I totally agree there should be something like <div src="your_externaldoc.php">

 

 
Page 1 of 2 12 LastLast

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
  •