Which Javascript history back implementation is the best? - asp.net

There are implementations for history.back in Micrososft AJAX and jQuery (http://www.asual.com/jquery/address/).
I already have jQuery and asp.net ajax included in my project but I am not sure which implementation of history.back is better.
Better for me is:
Already used by some large projects
Wide browser support
Easy to implement
Little footprint
Does anybody know which one is better?
EDIT:
Another jquery plugin is http://plugins.jquery.com/project/history It is recommmended in the book JQuery Cookbook. This one worked well so far.

One alternative to jQuery Address is the nice jQuery history plugin. There are also URL Utils.
Reference: AJAX History and Bookmarks.

If you are building an ASP.NET application then using ASP.NET Ajax Framework gives you many advantages and a nice-simple API to use server-side.
Below you can find an example that uses Browser History with ASP.NET Ajax
Create a Facebook-like AJAX image gallery
Both have a wide range support in browsers.
For me is easier to integrate Microsoft AJAX Framework in an ASP.NET page so again if you have an .aspx page it might be easier to work with ASP.NET AJAX

If you don't need exactly AJAX, i.e. updating only parts of the site on request is sufficient for you, then you can use invisible iframe as target for loading generated HTML file containing only JS script that updates/resets "updateable" parts of the site. This is cross-browser solution and doesn't need address polling.
Example, but not in ASP: kociszkowo.pl (Polish site)
When you click there in the section icon and your browser supports javascript, link is modified before being fetched - target is changed to iframe and href is suffixed with .dhtml to inform server, that we're interested in a special version of the page. If you press Back in your js-equipped browser, then previously fetched iframe page is loaded from the cache. Simple, but requires some decisions at architectural level.
This link modification is irrelevant here, it's just the result of combining JS/non-JS world.

In my experience, your best bet is using the same one that you have doing most (if not all) of your ajax calls. For instance, if you're using asp:UpdatePanel's, use the MS one - if you're using jQuery.ajax, use the jQuery history plugin. If you're doing a mix (which I've tried to avoid in my projects), I'd personally test with both and see which behaves better - if they both test fine, then it's a bit of preference. Some may argue the Microsoft one would have better support, but jQuery's history plugin may get more use and more mature.
http://msdn.microsoft.com/en-us/library/system.web.ui.updatepanel.aspx
http://docs.jquery.com/Ajax/jQuery.ajax#options

Related

Existing full ajax jQuery site must become search engine friendly?

I've built a full ajax site using jQuery and asp.net. All database data are loaded dynamically via client-side ajax calls. There are no html forms or postbacks, just ajax calls to a web service returning (xml) data.
Now, I need to make the site SEO friendly with emphasis to google. What is the least time expensive way to do it? Is there a way jQuery or asp.net can help me with out-of-the-box solutions/components etc? On the other hand, there is the google specification but is it standard or easy to implement in my case?
Any help or ideas much appreciated.
your question is kinda unspecific.
jquery is javascript - based on how it's implemented can be very bad for SEO
asp.net is server side - can be anything, what counts is the HTML you have on page.
for a start i would recommend googling your site, then click on the "cached" link below it, then "text only version" ... this is what google sees. if you can makes sense of it, then google can make sense of it. if there is nothing there (possible for a very very ajaxy site) then well you are in trouble. then go to your competitiors site and do the same. if he is doing a better job look at his HTML sourcecode and think about ways you can get in this direction.
you would maybe also like to take a look at http://code.google.com/web/ajaxcrawling/docs/getting-started.html

Client side library or AJAX Control toolkit? - ASP.NET

For a slick UI, I am deciding between using a client side library (JQuery or ExtJS) or go with the AJAX Control toolkit. I understand that the widgets supported by ExtJS rich library does not match what's there in the toolkit.
What are the pros of cons of using one over the other?
I'd choose AJAX Control Tool Kit + PageMethods (avoid UpdatePanel, it's easy to use at the beginning but it can be a real nightmare ) + JQuery to parse/display the result of the page methods.
PageMethods are really easy to use.
But do not use ajax control toolkit 's controls, it's easy to do the basic stuff , but when you want to be more specific, you're fighting against the toolkit (sometime you have bug with IE but not with FF it's really fun).
I am a asp.net developer and php+joomla developer.
With due respect to microsoft, i am completely fed up with ASP.net AJAX.
Working with Asp.net Ajax sucks(pardon my french).
You dont have complete control of your html code, because it generates freaky divs.
Asp.net Ajax carries a dead weight of code and javascripts with it, thus consumes the lot of bandwith which affect on your page load response time.
If you go with asp.net AJAX, you will be limited to it.
Jquery is very fast and can be implemented within no time.
Jquery has thousands of plugins developed by community developers and for free.
If you have any javsacript error with asp.net AJAX, it takes hell lot of time to get solved, or you have to change the code to different concept. I mean its complicated to debug asp.net ajax code.
After, trying hardly to use asp.net ajax, i finally landed to jquery and very happy to use it. One thing to be clear i am here, by not any means, not promoting jquery.
But using jquery is far more easier, flexible and performance oriented than ASP.NET AJAX.
From my perspective, vendor specific frameworks like the AJAX control toolkits only benefit from the ecosystems and examples published by that specific vender (and 3rd party devs). In this case, only Microsoft and ASP.NET developers.
In the case of a vendor agnostic toolkit like jquery, you gain the benefit from every type of web developer that's out there publishing blogs and articles: ruby, python, coldfusion, asp.net, etc.
So my vote is usually for jQuery unless there is a very specific reason (ie. specific control) that I absolutely have to use from the ajax control toolkit. And even in those cases, chances are that someone has a jquery plugin that'll be equivalent.

Tips for developing an ASP.NET application that doesn't depend on JavaScript

Not sure if this belongs in community wiki...
Can somebody give some general guidelines on how to successfully build an ASP.NET site that isn't dependent on JavaScript? My understanding is that I should build a functional site initially without JavaScript, and use it to enhance the user experience. That is easier said than done... how can I make sure my site works without JavaScript short of disabling JavaScript and trying it? Or is this something that comes with experience?
Try ASP.NET MVC! sure most of the examples use JavaScript for the AJAX functionality, but it's easy to build a fully functioning site that doesn't use JavaScript.
Since ASP.NET MVC doesn't use server controls with all their embedded JavaScript, it's a great way to build a site with very minimal and lightweight HTML, while still writting your data access and business logic in C#, VB.NET, or any other .NET language.
I've built working ASP.Net sites with little or no JavaScript, so it's definitely possible (just a royal pain.) The trick, and this sounds silly, is to use as few <ASP:> type tags as possible. Those all spawn various levels of JavaScript. Regular old-school HTML elements work just fine with no scripting.
So, on the extreme end, you write, say, your form using all plain-vanilla HTML elements, and then you have that form submit point at another page that accepts the form submit and hands it off to your server-side scripting.
To put it another way, pretend that all you get with ASP.NET is a snazzy server-side programming language and you're writing HTML in 1998.
Now, having done this, I can tell you that what this ends up as is a classic ASP webpage with cleaner programming syntax. ;) Most of the features that make ASP.NET "better" than classic ASP hang on JavaScript, so writing a JavaScript-free ASP.NET system is an exercise in shooting oneself in the foot repeatedly.
However, the one thing you should absolutely do is make sure the first page or two do work without JavaScript. Unlike 10 years ago you can safely assume that any browser hitting your page has JavaScript, and unlike about 8 years ago, your visitors probably don't have JavaScript turned off for speed reasons, but they very well might have something like the NoScript plugin for Firefox dialed all the way to 11. So, your first couple of pages need to work well enough to a) tell the new visitor that they need JavaScript, and b) still look and work good enough to make it look like adding your site to the white list is worth it. (In my experience, most people get the first one done, but in such as way as to totally drop the ball on the second. To put it another way - if your super fancy web 2.0 mega site starts looking like craigslist if noScript is fired up, I'm probably not going to bother letting you run scripts on my machine.)
If you want to use many of the ASP.NET controls (i.e. the DataGridView), ASP.NET pages are generated with lots of JavaScript in order to handle the events on the controls (i.e. selecting a row in the DataGridView). I think you're going to lose so much of ASP.NET that trying to have ASP.NET work without JavaScript enabled is impractical.
Disabling Javascript is the best way to test how a web site performs with out it. Good news, IE8's developer tools provide a quick and easy way to do just that. Now, having said that, often times the only thing that you can do is put up a message with a noscript tag to the effect that your site requires javascript for best function.
Many ASP.NET functionalities & controls won't work when JavaScript has been disabled. Think of LinkButton's onclick event which contains a call to a JavaScript function.
LinkButton is just an example. But there are many other things too.
If your concern is with JavaScript being disabled in user's browser then you can check for that and handle your site accordingly.
If you do decide to build the site without JavaScript then you will end up building a somewhat static web site. If your need is just to build a static website then you can go on with this approach.
Write everything with basic html forms and css, and then you will know that it works without javascript.
Once you are happy with it, then look at unobtrusive javascript, so you can modify the way the application works when javascript is enabled.
Last time I looked at some stats about this around 1% disable JavaScript, so why spend hours and hours on this when what you should do is show a message telling the user that your site requires javascript.
Use your time to be productive instead of trying to write around perceived limitations.

Feeding .NET MVC Views the jQuery UI way

I've seen a few blog posts and tutorials overviewing mixing in jQuery and the UI elements for Views in a .NET MVC web app. But usually targeted at developers with a comprehensive grasp of the full dev cycle and variations of back/middle tier technologies.
As the front end developer I'm pitching a jQuery-only UI to the back-end dev - he cautions against a non-webforms interface for sake of the code maturity pov.
I'm trying to hit back with "well...it's your pattern ...isn't it elemental to MVC? No logic in the view? I'm reading that to be 'server-side stuff'. You just serialize the properties i'm asking for, or better...let me easily discover what you _can send me...i'll be able to implement the UI via jQuery UI."
So how valid is my position?
Can jQuery's grid be expected to handle at least the bottom 85% of .net's native control (low-to-moderate capacities # of rows)?
How about in-line editing? ...from the grid?
Would working exclusively in Web Services simplify his life at all? and if so, wouldn't that be logical way to build a .net-to-jQuery relationship? - ajax liaisoning twixt server (.net WS methods) and client?
mny thx
--steve...
Don't fight the platform. That way lies pain and suffering.
The MVC view objects are vastly different than asp.net webforms with server controls--you get straight up html. You get jquery and ajax basically for free, with (almost) magic server side ajax call processing.
They are designed to do what you ask. Writing your own jquery ui is reinventing the wheel.
Not only would it be a ton of extra work for no gain. You would be the only developer around trying to do that, and when you needed help, few could offer advice.
If this is an admin interface, and the client has agreed that users must have javascript enabled then I think using javascript to build widgets on the page is a better option than using the asp.net server controls. If however this is a public facing website I would argue that a pure html and css approach is much better, and then use javascript to progressively enhance the page!
Now I dont ever advocate using asp.net server controls, because they spit out poor markup and they are overly complicated to use. Instead I have been using jQuery to do the grunt work and dom querying and traversing. I also dont advocate using jQuery UI because they are missing some very essential widgets, for example no datatable, no treeview etc. I know that there are lots of plugins for jQuery but they are not componentised and therefore each plugin needs to reinvent the wheel to achieve everything it needs. Once you have included all your plugin libraries and css you often end up with a very large page footprint. Also each plugin often has a different home page and documentation that may or may not be up to scratch.
I think that the best UI library is YUI, and you can easily combine it with jQuery. Because each widget is made up from core components the overall weight of download is smaller. Also you have all the documentation in one place with 100's of working examples. Also it means working with the same set of javascript patterns across the board, so with each widget you learn more and more about the library. Hopefully jQuery UI will catch up, but personally I am looking forward to YUI 3 which for me might mean dropping jQuery altogether...
jQuery is a very mature library. It is used by thousands of people across the internet, and I dont think I have ever encountered a bug. YUI is dogfooded by YAHOO so it too is battle hardened.
One thing I did not mention to you is that I am using the default webforms view engine with asp.net mvc. I think it is still the best option as you get intellisense and also Resharper refactoring even searches your views, and the static solution anaylsis can find code errors in your views.
For building my markup I have been using MvcContrib Fluent Html but you could also checkout this article that advocated the DRY principal very well.

ASP.NET: Making something similar to Facebook application bar

Is there a built-in control that is close to an application bar at the bottom of Facebook, or is such a function only available through the use of JavaScript/AJAX?
Remember that ASP.NET is server-side, so it controls all processing that takes place before the web page even reaches the user. For functionality like what you're talking about, you need browser-side voodoo like Javascript. So...
Javascript is practically required.
The only other feasible alternative would be Flash.
XML would not be necessary (or even necessarily desirable).
Don't fall into the trap of calling all asynchronous, Javascript-driven behavior "AJAX", because much of it isn't.
I just built something like this in ASP.NET. I recently posted a blog on how to do it. Check out how to build a Facebook Application Bar in ASP.NET.
I used two controls from ComponentOne to help out, the C1Menu control and the C1ToolTip control
I imagine you mean this:
Screenshot: http://screencast.com/t/kqFPArcmYQ
Video: http://screencast.com/t/X6IczIIv
If that's the case, no, it cannot be done with ASP.NET alone. You are correct in assuming it would require javascript, and possibly some AJAX to make those asynchronous calls.
You should look into javascript libraries, such as jQuery & jQuery UI, or MooTools, etc. Those give you a breadth of tools and plugins to create wonderful/dynamic UIs.
http://jquery.com/
(jQuery UI Demos)
http://mootools.net/
(MooTools Demos)
Check out the demos on their pages, to see if those will fit your idea. You can definitely build the core of the menu in ASP.Net, and then use a javascript library to get the dynamic feel that you're looking for.
Hope that helps a little bit.

Resources