|
INTERVIEW QUESTIONS
WEB
AJAX
DETAILS
Question: How do I handle the back and forward buttons in AJAX?
Answer: While you could go out and create a custom solution that tracks the current state on your application I recommend you leave this to the experts. Dojo addresses the navigation in a browser neutral way as can be seen in the JavaScript example below.
function updateOnServer(oldId, oldValue, itemId, itemValue) { var bindArgs = { url: "faces/ajax-dlabel-update", method: "post", content: {"component-id": itemId, "component-value": itemValue}, mimetype: "text/xml", load: function(type, data) { processUpdateResponse(data); }, backButton: function() { alert("old itemid was " + oldId); }, forwardButton: function(){ alert("forward we must go!"); } }; dojo.io.bind(bindArgs); }
The example above will update a value on the server using dojo.io.bind() with a function as a property that is responsible for dealing with the browser back button event. As a developer you are capable of restoring the value to the oldValue or taking any other action that you see fit.
AJAX: How to Handle Bookmarks and Back Buttons details this problem and provides a JavaScript library Really Simple History framework (RSH) that focuses just on the back and forward issue.
|
|
|
Category |
AJAX Interview Questions & Answers -
Exam Mode /
Learning Mode
|
Rating |
(0.2) By 8985 users |
Added on |
9/22/2014 |
Views |
68131 |
Rate it! |
|
|
Question:
How do I handle the back and forward buttons in AJAX?
Answer:
While you could go out and create a custom solution that tracks the current state on your application I recommend you leave this to the experts. Dojo addresses the navigation in a browser neutral way as can be seen in the JavaScript example below.
function updateOnServer(oldId, oldValue, itemId, itemValue) { var bindArgs = { url: "faces/ajax-dlabel-update", method: "post", content: {"component-id": itemId, "component-value": itemValue}, mimetype: "text/xml", load: function(type, data) { processUpdateResponse(data); }, backButton: function() { alert("old itemid was " + oldId); }, forwardButton: function(){ alert("forward we must go!"); } }; dojo.io.bind(bindArgs); }
The example above will update a value on the server using dojo.io.bind() with a function as a property that is responsible for dealing with the browser back button event. As a developer you are capable of restoring the value to the oldValue or taking any other action that you see fit.
AJAX: How to Handle Bookmarks and Back Buttons details this problem and provides a JavaScript library Really Simple History framework (RSH) that focuses just on the back and forward issue. Source: CoolInterview.com
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|
|
Related Questions |
View Answer |
|
How does HTML_AJAX compare with the XAJAX project at Sourceforge?
|
View Answer
|
|
How do I submit a form or a part of a form without a page refresh?
|
View Answer
|
|
How do I send an image using AJAX?
|
View Answer
|
|
How do I provide internationalized AJAX interactions?
|
View Answer
|
|
How do I test my AJAX code?
|
View Answer
|
|
Is Ajax just another name for XMLHttpRequest?
|
View Answer
|
|
Is AJAX code cross browser compatible?
|
View Answer
|
|
Is Ajax a technology platform or is it an architectural style?
|
View Answer
|
|
Is Adaptive Path selling Ajax components or trademarking the name? Where can I download it?
|
View Answer
|
|
How do we handle concurrent AJAX requests?
|
View Answer
|
|
How do we get the XMLHttpRequest object in AJAX?
|
View Answer
|
|
How do we debug JavaScript?
|
View Answer
|
|
How do we create a thread to do AJAX polling?
|
View Answer
|
|
How do I access data from other domains to create a mashup with Java?
|
View Answer
|
|
How do we abort the current XMLHttpRequest in AJAX?
|
View Answer
|
|
How Ajax is Different?
|
View Answer
|
|
What about applets and plugins?
|
View Answer
|
|
What parts of the HTML_AJAX API are stable?
|
View Answer
|
|
What kinds of applications is Ajax best suited for?
|
View Answer
|
|
What JavaScript libraries and frameworks are available for AJAX support?
|
View Answer
|
Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.
View All AJAX Interview Questions & Answers - Exam Mode /
Learning Mode
|