Stick SoundCloud player - c#

Is there a way to create a sticky music player, like soundcloud so that when you browse from one page to another on your site your music keeps playing without being interrupted with a postback?

You need single page application for that, you cannot stop the player from interrupting when reloading the whole page.

As I'm looking for the exact same solution, I can tell you: It's not possible without making your whole website using AJAX technology.
So you have to modify your whole page in a way, that the basic HTML construction is always open, and all internal links opens within the AJAX controlled containers.
There is no and probably will be no other way.
One service that does that is bandzoogle.com as you can see in one of their pages here: camilameza.com
When you inspect their code, you can see, that all interaction within the site is within one single container which switches the content.
Good luck!

Related

How to display multiple pages under tabs similar to a Browser tab retaining loaded pages

We have an application where we have a single level navigation menu with some heavy-duty pages on each link. The user can switch back and forth between these pages frequently to obtain information that he needs.
Once the page gets generated, it wouldn't change for the session. However, the page is specific to the user, hence we cant cache it.
I was trying to come up with a solution where we generate the page once, and keep it hidden in the background until its link is clicked, but haven't been able to get my head around this.
One of the ways I thought was to have multiple div tags (one for each page) on one page and keep toggling the visibility as the links are pressed, but that would end up making this single page very heavy. Someone also suggested using iFrames, but I am not really comfortable using the iFrames much and I'm not even sure, if it would be any helpful either.
Can you guys please suggest a few approaches to tackle the issue?
update: Just to clarify, we are fine with keeping the pages separate and navigate across using a standard menu bar. We were just looking for ways to optimize the performance as we know that the pages once generated wouldn't change and there should be some way to tap that benefit.
You can use Ajax tab control for this purpose
Try taking a look at this MSDN article which specifically tackles the issue of how to user-level cache. Also, it might be more manageable to break each tab into a user control. That way your ASP.NET page has just the tab control and 1 user control for each section under the tab. It makes managing tabs much easier.
EDIT:
What I would do in your case, since you say the data won't change for the user, is I would grab the static data from the database and then I would store that data in the Session cache. THe session cache is specific per user and you can try to retrieve the static data from there instead of repetitively calling the database.
Check out the ASP Multiview control. Just remember that even though the different views are hidden when not active, their viewstate is still being sent back and forth. Can be a benefit if you need to check control values across views though.

How to show the list of recently visited web pages as chrome does

I would like to display the list of recently accessed/visited web pages just as google chrome shows. I want to achieve this using C# and asp.net.
I am working on a site where the user can see the list of pages that they have visited, I tried using iframe but that does not work as per expectation. I am looking for a clean and intuitive interface something like google chrome.
I would like to provide a thumbnail view of the recently visited pages.
To keep my question simple, I want to display a list of urls as thumbnails, just as chrome does
Note that Chrome can do it easy, as they get to render the page and can take a bitmap snapshot of it easily to show for the thumbnails. (These are not live websites in there)
If you want to do the same thing, you have to render the website offscreen and take a snapshot to show to the user.
If you want to actually show a live website - now that's another story. There are a lot of sites that don't like being shown in the context of another website (for whatever reasons - security, marketing and so on) and will employ any tricks (including legal) to make sure this does not happen.
Pages only visited within your own app?
There are several components that will alow for that using their api. For example:
http://www.tonec.com/products/wssh/index.html
You can just take a snapshot after the DOM for tha page is completely generated and save the output using the tool on peruser basis.
Now, if you want something more generic that works for any web site, you'd probably want to go with a web browser plugin.
Here would be a possible solution, although I've not tried it personally:
Keep a record of all the pages that a user visits (e.g. in a database)
When the user visits a landing page on your site, you could call the WebBrowser.DrawToBitmap function to render a bitmap of each page they have visited recently.
Please note: this is just a theory, I'm not saying it will work! ;)
This link might help you get started:
http://pietschsoft.com/post/2008/07/c-generate-webpage-thumbmail-screenshot-image.aspx

What are the MUSTS for having an asp.Net application to support BACK button of the browser?

Is there any pattern or kind of "least requirements list" to follow for ensuring an asp.NET application to support BACK button of the browser for each aspx page?
thanks
In general, the back button on the browser will take you to the previous HTML GET or POST that occurred. It navigates by page-wide transactions, so anything done dynamically cannot be navigated that way. Also, the back button doesn't rewind code execution, so if you are determining something based off of a Session variable or something similar, that won't be rewound either. Obviously, it won't rewind database transactions either.
In general, if you want to support the back button, you'll need to make sure to divide everything you need to navigate between with said button is divided by an HTML transaction of some sort.
Again, you're going to run into issues if your page display is dependent on server-side control that changes from one post to the next. This is one reason you see some forms feed a 'Page has expired' error when you try to navigate back to them.
Not really... It depends on your application flow.
There are things that make supporting the back button more awkward.
for example using pure ajax to change the majority of the content on the page,
will look like a 'new' page but wont be compatible with the back button (though you can fudge it)
another example is posting back to the same page more than once, as this can make it appear like the back button is not working, and at the same time re-doing your request (and therefore database transactions)
Fundamentally it depends on your application requirements.

Weird "Next" link on ebay?

I'm working on a web scraping application and was testing it with ebay. The thing is that the application should follow the link "Next" (the one at the bottom of the page that should go to the next page of results) but it kinda stays on the same page (yea, i'm actually not sure about that). If you try to open ebay and search for any term that will give a result with multiple pages, and then either copy the link of "Next" and paste it on a new window or right click it and select open in a new tab/window, it will stay on the same page. I tested it on Chrome and IE8. So my question is what are these browsers doing when they actually follow the link (when I just click on it) so that I can do the same with my scraping application? (Oh, and by the way I'm working on C#)
In the case of eBay it is just a normal link (at least on http://www.ebay.com, look for page 2 of TV's) so the problem is probably with your code (are you storing cookies for instance?). From your description it sounds that it's an AJAX request, which would go "under the hood" and gets XML from the server which is rendered by JavaScript on the client side.
Traditionally, AJAX requests are hard to follow. In the case of ebay, however, I'd suggest use the interface that ebay has to query for information. If you are building a generalized web crawler, then stay away from the AJAX requests. Google doesn't bother either, most of the time.
I did a element.InvokeMember("click"); (where element is an HtmlElement) and it worked. Not sure why though. I'll take a look at that HTTP GET thing anyway.

Tracking actions in a browser component

Im a c# developer and I believe that what I want to achieve is going to move out of the realms of some drop in .NET component so I am looking for advise on what I use externally which .NET can inter op with.
My requirements are to have an embedded web browser control in a WPF/Winforms applciation BUT I will also need to keep track of the following:
User interaction i.e. what pages they visit, forms submitted where they click etc.
DOM manipulation and traversing
I am guessing here but it seems that I might need to start looking at open source html/web browsers out there like WebKit etc. Is this the right track or is there anything currently available in the form of a control/COM object that I can use directly.
Cheers, Chris.
You should be able to accomplish point 1 using the webbrowser control in Visual Studio, but I dont think DOM manipulation is available, i do know you can traverse all the tags.
reference

Categories