Web Analytics Made Easy -
StatCounter javascript to search one page for a file path to put on another. - CodingForum


No announcement yet.

javascript to search one page for a file path to put on another.

  • Filter
  • Time
  • Show
Clear All
new posts

  • javascript to search one page for a file path to put on another.

    I'm working on a site built through Squarespace, and I've run into some limitations. They've told me it's possible to build a Javascript to pull specific images from one page's journal entries and place them (with links to the entry) on other pages.

    Can somebody send me in the right direction on how I would do this? Basically I want to find a most recent posting tagged with a specific category, find the file file path of it's related image, and make that appear on the page that my javascript is on.

  • #2
    This only possible if both pages are coming from the same domain. That is, if both pages are served up by the same web server (or at least server group).

    If it is, then it's not hard. But...

    -- Are both pages visible at the same time? That is, is one a popup from the other?
    -- If so, which page opened the other one?

    If only one page is to be visible, then the easiest way to do this is to load the other page into an invisible <iframe> on the visible page and then search for the desired content within the HTML of the invisible <iframe>.

    In any case, we need to know *HOW* the "most recent posting [is] tagged with a specific category". That is, what does the HTML that makes this obvious look like?
    Be yourself. No one else is as qualified.


    • #3
      Both pages are on the same domain. I was thinking I could have the first page load quickly, or hidden, then pull the info and pass the info to a second page. But <iframe> might make more sense - if it's possible with the cms program my client is using (Squarespace).

      Basically I'm building a page that's pulling rss feeds from individual pages on the same domain (built that way due to a limitation of the cms software the client is using) I want to detect the most recent post for each category, and pull the thumbnail picture to appear here, as the layout suggests: http://www.frontdoorsnews.com/-4/

      An example of the pages I want to pull the pic url from is here: http://frontdoorsnews.squarespace.com/from_the_heart/

      On this page, a specific div tag (div id="item12616108") matches the category. I could rebuild it to have divs for all the categories.

      Inside that div is another div class called "journal-entry-float-day". I can change that to include hour and minute, so it can be used to find the most recent post.

      Buried a couple div's down is an image. There will only be one per post, so maybe this is my method? Let me know if this theory works, and give some suggestions on scripting this? I'm a little bit new to javascript building.

      Hope I'm on the right path!
      Last edited by turpentyne; Aug 26, 2011, 01:51 PM.


      • #4
        Seems you have found the right idea, judging by your other thread that I have replied to. If not, ask again.
        Be yourself. No one else is as qualified.