Thank you for your input and tip. I did not know about these functions and have researched them for a few hours.zingg wrote:
Look up history.pushState and onpopstate - you can use this to drop in URL parameters without reloading the page, and then restore the state (i.e. load the selected video) using these URL parameters on page load.
As I understand in short: thanks to those functions I can 'produce' nicer urls for each video and later load it without reloading the rest of the site. I think that the current script handles reloading the relevant/changing content well- correct me if I'm wrong :) Whenever you select another video from the menu, only the content below the video title (and the video title ofc) is refreshed. Rewriting the urls for each video is nice as long as it is understood by crawlers, which apparently it is not in this case. Crawlers can understand static/html content perfectly, content that is served via queries from the database quite well (url rewriting helps), but served from the browser's history is ephemeral for the crawlers. What is more, whenever someone shares such a link, and another person accesses it form outside of the domain, he/she will be presented with a 404 - not found error. There is a workaround for this, where you can prepare php/sql pages that are served instead, but this in my opinion kind of defeats the idea of having lightning fast responsive web pages. This way we return back to the beginning where we have a heavy server CPU-load sql solution that we cannot ultimately part with.
That being said, I actually tested a similar setup, when I proposed a hybrid solution above. Access to the site from outside of the canonical address was served by php/mysql solution, while the rest was handled by javascript. The php/mysql part was still too much strain on the webserver, so it's turned off for now and all the requests that should have been handled by php/mysql are now redirected to javascript.
I'm not a programmer, I learn as I go, so I might not have fully understood your intention. Maybe you would be so kind as to provide a sample code relevant to the streaming site, so I can understand better what can be achieved with those functions?




