www.webdeveloper.com
Results 1 to 7 of 7

Thread: Can Javascript Pull content from a Window.Open page?

  1. #1
    Join Date
    Aug 2009
    Posts
    11

    Can Javascript Pull content from a Window.Open page?

    I'm a newbie to javascript and web development in general. First, let me say that this is just an attempt at a workaround until I learn how to use php and MySQL. Here's the scenario:

    <----- SCENARIO ----->
    I sell musical arrangements online. The catalog has hundreds of items. Each item has about a dozen pertinent fields: top-level specifying an ID, Song Title, Group Size, Style, et cetera; and details, specifying specific instruments for a particular arangement.

    The previous version of my website simply contained links to pdf files with lists (the top level detail only)

    For the redesign, I'm trying to give the visitor more info and also allow the visitor to select specific titles to add to an order.

    The source date is from a Microsoft Access database. I have written some Visual Basic that reads the source data table and produces HTML code for a table that contains the desired info.

    The size of the table is way too big to put into the window, so here's what I'd like to do if javascript can do it. Note that the data IS STORED in a separate .htm file but that file is not accessible to the viewer.

    (1) In my Catalog.htm page, include an Body Onload function that opens the .htm file with the data using a window.open() method;
    (2) Read and save the data in an array in javascript. Then close this window.
    (3) Allow the user to specify what song titles to show in the Catalog page by setting criteria in a form on that page;
    (4) Load only the top-level info that matches his query for up to10 titles at a time as content in specific tagged elements on the Catalog page.
    (5) Use mouseover to display a popup with the detailed info for any of the titles.

    <---- WHAT I DON'T KNOW ----->
    (1) Can javascript called by one window read data from another window? If so, what is the method for doing this?
    (2) If (1) can be done, will the data read be persistent for as long as the Catalog window/page is open?

    Thanks in advance for any help

    TDinDC

  2. #2
    Join Date
    Aug 2009
    Posts
    13
    Yes, use xml http object.

  3. #3
    Join Date
    Aug 2009
    Posts
    11

    Re your reply to "Can Javascript Pull content from a Window.Open page? "

    Sorry, but that answer is very cryptic. Can you expand it, please, to describe what you're trying to tell me in more detail. Use XML http object for what?

    Thanks,

    TDinDC

  4. #4
    Join Date
    Dec 2002
    Location
    Pleasanton, CA
    Posts
    2,132
    Quote Originally Posted by TDinDC View Post
    Note that the data IS STORED in a separate .htm file but that file is not accessible to the viewer.
    If it's in .htm file in the webroot directory, it's veiwable by anybody.

    If you can do (5) in the upper list then (1) in the lower list should be easy.
    and yes, the data will be persistent if I'm reading that right.

    So what do you need help with?
    I'm thinking you need help with all of this.
    Try google for 'shopping carts'. They have a lot of the functionality you are looking for. This is a fairly advanced task requiring some sort of server-side scripting as well as client-side javascript.

  5. #5
    Join Date
    Aug 2009
    Posts
    11

    Nedals: Re your response to "Can Javascript Pull content from a Window.Open page? "

    Thanks Nedals,

    I guess I misspoke when I said it couldn't be viewed - it simply doesn't show up on navigation and I don't expect that any visitor to my site would go looking for it - they simply want to know what products I have to offer. They're just bandleaders looking for arrangements, and finally I don't care if they look at it - the catalog is HUGE, unwieldy in the browser, and it's structure is more suited to a relational database solution. That's why I said in my original post that this is just an interim solution that I'll eventually implement with php and MySQL.

    You're probably right that I need help with all of this, however I'm having fun and working on this to learn as I go:

    - I'm recently retired from a 35+ year technical career from R&D to Systems Engineering (stayed clear of management, thank God!)
    - Now I'm back to my music business full time - a luxury I didn't have when I worked a 9-to-5.
    - I've always been a quick learner in about whatever I tried to do (but I'm still a newbie in newer web technologies)
    - I designed my original website about 8 years ago when my musical projects were first getting off the ground (I was a professional musican for ten years before moving over to technical fields)
    - At the time, I used FrontPage because its basically an easy to use WYSIWYG tool, but it doesn't write W3 DOM compliant code, so I'm redoing everything:
    (a) to design a much slicker website with the hopes of attracting more business,
    (b) to learn and incorporate newer capabilities, and
    (c) for fun and the never ending quest to learn something new

    So, I've inundated myself with learning javascript, php, and other new 'stuff' on my own. I can and will learn what I need, I'm not in a big hurry, and I look at developer forums like this as a invaluable resource to point me in the right direction. For example, after reading fuadr's cryptic response (last night I didn't know what an XML HTTP object was, nor how it could be used. But since then I've done some research and probably could write the javascript to pull xml-formatted data from a document on the server.)

    Bottom line - this is all good.

    Again, thanks;

    TDinDC

  6. #6
    Join Date
    Apr 2008
    Posts
    157
    There is no need for XMLhttp, at least in Firefox it's possible to just use standard DOM on opened windows.

  7. #7
    Join Date
    Dec 2002
    Location
    Pleasanton, CA
    Posts
    2,132
    Since you are learning and want to try things, you could start with...

    On a starting page, enter some data that will be used for a search

    Use Ajax to read your 'database .html page' and, based on the above input, extract the info you want. You may need to re-organize this page. I would change it to a .CSV file and organize it the same way that your future database will be organized.

    Then use something like 'GreyBox' to display the content. You will not need a popup, and it's much prettier.

    Have fun.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles