Results 1 to 3 of 3

Thread: Close music window

  1. #1
    Join Date
    Mar 2009

    Close music window


    Newbie to the forum and almost totally ignorant of javascript programming (although not totally ignorant of programming in general).

    I'm trying to have music playing uninterrupted across all pages of an html website project (site owner's request despite my advice). I'm using the following method :

    1. when index.html is loaded, the music.html page also opens automatically in another window

    2. the window containing music.html is automatically minimized

    3. On each page of the project (i.e. not on the parent index.html page) there is a "Turn music off" button/link. When pressed, the music.html page window should be closing.

    4. Ideally, the music.html page window should also be closing when the user closes the window containing the main site (index.html and the other site pages).

    5. More ideally, the music.html page window should also be closing even if the user does not close the window containing the main site but just navigates away to another website.

    Through research I managed to do 1 & 2 above using bits of javascript code.
    I am now stuck with 3 and can't find how to do it (and I'm not even dreaming yet about 4 and 5...)

    Can someone assist ?

    Thanks !

  2. #2
    Join Date
    Jan 2005
    I'm not sure you can do that. Once the browser navigates away from the parent window (initiating the js-called music window), you'd lose all your variables that control the child music window and/or its association to the "new" browser pages.

    The only way I know of to do this is to have the user click on a link, and have the music come up in their default media player. Then, they can turn it off at will, as well as retain the music playing while navigating through the site.

    Another way (though not recommended) is to use frames, where the music player is in the main frame layout and the content (within the frame) changes. But, that's really old-school/not-too-user-friendly coding.

  3. #3
    Join Date
    Mar 2009
    Thanks for your reply KDLA.

    In fact I already tried also the iFrame trick but it doesn't work because there is a "lightbox" type script in one of my other pages which behaves strangely through the iFrame, i.e. the images appear at the lower side of the screen (instead of being centered) and you have to use the scrollbar to view the whole image. I guess this could most probably be fixed by altering the slideshow code but this looks like a very time consuming project for "javascript-ignorant" me.

    Your suggestion to use a "start/stop" music link would also be my best choice, however the client insists that the music should auto-start when the site loads.

    (I'm really tempted to forget all about the "music-off" button since the client is not concerned with it at all, but I want to be a responsible person and prevent future visitors of the site from having thoughts about hitting both me and the site owner on the head with things).

    Anyway thanks for your post. I'll scratch my head again and hopefully I'll think of a different approach.

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