Uninterrupted background music on website

后端 未结 7 1878
自闭症患者
自闭症患者 2020-12-03 22:44

I was making a website for a music band, and i was wondering the best way to play background music on the website without interrupting the flow of the music (even for a spli

相关标签:
7条回答
  • 2020-12-03 23:15

    It wouldn't be pretty but you could do it using AJAX. Have the master page with the header/footer/navigation controls with a big empty content div, and instead of regular links you have calls to AJAX functions that return HTML to be injected in the content div.

    I tend to agree with the others who recommend frames. It may be considered "bad practice", but so is playing background music in the first place.

    0 讨论(0)
  • 2020-12-03 23:19

    I can think of four ways:

    • Frames, as you said.
    • Make your entire website in Flash and have only one page. You need to know Flash to be able to do this, which could make this difficult.
    • Pop-out your music player. This is probably the easiest approach, but the downside is this could be annoying, and a lot of web browsers these days would block it.
    • Use AJAX and dynamically load all your site content within one page, like Gmail. Users will need to have newer browsers, and this will take quite a bit of coding on both the client and the server side.
    0 讨论(0)
  • 2020-12-03 23:23

    As was said, to do that you have to prevent your website from relaoding.

    An option to achieve this might be to use asynchronous requests to modify your website content without reloading the whole page, that's basically what Ajax is about.

    That being said, I sort of agree with Alex here : dont' play music.

    0 讨论(0)
  • 2020-12-03 23:31

    The only way to prevent the music from stopping is to not let the page your music component is on reload. Currently the only way to do this is to use frames, unfortunately.

    The only alternative is to develop the whole site in Flash or another technology that doesn't rely on changing pages as navigation.

    0 讨论(0)
  • 2020-12-03 23:32

    This may be a topic for another post, but why would you cosnider IFrames to be good practice? you could out the content you want to change into an IFrame and have your code running your music player ouside it. When you load a page it woul load on the IFrame. Just a thought...

    0 讨论(0)
  • 2020-12-03 23:36

    This might sound controversial, but here's an idea: Don't play music on your website. Seriously, don't. I think everyone knows how incredibly annoying that is, and asking a group of software developers to help you out with that is going to be like asking a group of sheep the best way to make a lambskin coat.

    If you really have to do it, frames would be the simplest way, so I'd do that. But you're not going to do it anyway, right?

    0 讨论(0)
提交回复
热议问题