Results 1 to 2 of 2

Thread: Loading Div from separate page in same domain into another page's div

  1. #1
    Bomberman is offline New Member: Posts Will Be Moderated
    Join Date
    Apr 2011
    Posts
    1

    Loading Div from separate page in same domain into another page's div

    For a further explanation:
    I want to load a div from my #news1 div in my recentNews page onto the homepage's div #latestnews.

    recentNews.html

    <div id="news1">
    Title
    Body
    ect.
    </div>

    This will be pulled onto:

    index.html

    <div id="latestNews">
    script here for pulling other div.
    </div>

    could anyone help me out with this? I'd prefer to use javascript atm because I don't have a server to test on.

  2. #2
    Join Date
    May 2011
    Posts
    19

    XSS issues between pages

    You run into XSS (Cross-Site Scripting) restrictions reading from / writing to separate pages, even when they are both in your own domain. The only way to avoid these entirely in JavaScript is when both pages are part of a single frameset (sorry, frames are deprecated so this is at best a short-term solution).

    Using iframes will let you achieve the look, if not the fact, you want. Just open an iframe into page #2 inside a div on page #1.

Similar Threads

  1. Display div once you scroll down the page...challenge?
    By mikemiketm09 in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 1
    Last Post: 04 Apr 2011, 02:52 AM
  2. Html page with div
    By gauri_agr in forum Web Design, HTML Reference and CSS
    Replies: 1
    Last Post: 16 Apr 2009, 12:33 PM

Posting Permissions

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