views:

618

answers:

3

Hi, I want to create a web page that contains an (Flex/Flash) audio player that doesnt get reloaded when the page reloads. Currently, i am popping out the player in a new window. Please check http://www.paadal.com to see it in action.

What i want to achieve is to have the player in the same window, but it shouldnt reload. I am sure many of you will say use AJAX to prevent reloading of page like songza.fm. But the problem is search engines cannot index AJAX applications. This is true for a full fledged Flex app as well.

Is there any way to have the player in the same window? but not reload.

Thanks

+2  A: 

Just add Ajax to existing page hierarchy, change each link to ajax call after page load (with javascript) and only reload content of some container. If you do it that way, search engines (and users without JS, with mobile phones for example) can access your page, and users with JS enabled can get bonus as music player

MBO
This is what amiestreet.com does also. It changes links like <a href="artist"> into <a href="#artist"> on the client side. Then it uses something like the jQuery History plugin http://www.mikage.to/jquery/jquery_history.html to turn the #artist call into a AJAX request for new page content. Someone without javascript (search engines) would navigate around the site and index it as usual.
DavGarcia
+1  A: 

No, you cannot have a single element exempt from a page-reload, not without loading portions of the page via asynchronous calls to the server. When a window refreshes, it flushes the DOM out, including your mp3 player.

Jonathan Sampson
i was thinking about having the player in a different frame. Would that work? Is using frames advisable?
Aravindan R
1. Yes. 2. No. :)
Pekka
Aravindan, no. The only way would be to place the music in a different window.
Jonathan Sampson
Well, frames are technically possible but bring a heap of additional problems to worry about. Alternatively, there is at least one Flash Music player that aims to keep a near-constant stream of music playing (well, obviously with interruptions but they are kept as short as technically possible) even when switching between HTML pages - I forgot its name but it should be possible to find by asking on SO or creative Googling. I never got around to actually testing it, though. The simplest best solution is a popup window.
Pekka
Pekka, I think he was referring to iframes. Since using traditional frames would bust the address bar reliability and cause it to be static to the browser.
Jonathan Sampson
A: 

saying "searching engines cannot index AJAX apps" is totally dependent on how the application is written, there are plenty of ways to write an application that is still spider-able and plenty of other techniques for indexing (like www.sitemaps.org implimented by most major search vendors)

You can not maintain anything in a browsers memory after leaving the page (which is implied by a page reload)

For your use, it sounds like using old HTML frames/framesets could easily solve your issue, with a hidden frame containing your audio and the rest of your site in the main frame window.

ozone
interesting. Pardon me if the question is trivial. So, i can create a hidden frame using javascript and attach it to my parent frame. When the user reloads the page,only the parent frame gets reloaded, not the one i created. The player is in hidden frame, so audio isnt interrupted on refresh. Did i interpret your answer correctly?
Aravindan R
Aravindan, if the frame is within the parent, and the parent is refreshed, the frame will be refreshed too.
Jonathan Sampson
...by "hidden" I was referring to a frame that has a width or height of zero, not in the CSS sense.I have to say that although I can see an easy path to using frames, I would _NOT_ recommend them since they are Why not take some time to deconstruct how The Hype Machine does it (http://www.hypem.com)
ozone