ALL
An experience on fixing HTTP 406 Not Acceptable error
This post is about an experience of mine on fixing a HTTP 406 Not Acceptable error seen on one of my page.Just got back from a business trip and opened my computer as usual to start to monitor my website statistics. But when I opened the page on showing real time page views, it shows nothing but zero. So I pressed F12 to bring up the developer tool to check on what's going on. The logic of loading the real time page view is backed by AJAX call. In the developer tool console, I see that the rAJAX request gets HTTP 406 Not Acceptable error. And in the network tab, see similar result.This confuse...
10,499 1 HTML AJAX HTTP 406 PHP CONTENT-TYPE
Let browser prompt for storing password when doing AJAX login
In Web 2.0 era, more and more web applications are using AJAX to replace the traditional HTML form element to perform user login. This usually provides a better user experience than form submission. But it also brings a side effect to the end users. That is the browser will not prompt the user whether s/he wants to save the password so that s/he no needs to enter the username/password again when visiting the same site next time.Below is the code snippet which does the AJAX login. <script style="text/javascript"> $(function () { $('#signin').bind('click', function () { //Sub...
Useful functions to provide secure PHP application
Security is a very important aspect of programming. There are many functions or modules in any kind of real programming language providing security functionalities In modern websites, we may often get inputs form users all around the world.There is a famous saying which says that never trust user input. So in web programming languages, we will often see functions which will guarantee the security of the data input from users. Today we will cover some of these functions in the most famous open source language - PHP.In PHP, there are few useful functions which is very handy for preve...
26,498 0 PHP SECURITY SQL INJECTION XSS AJAX
How to let Google index AJAX contents?
There are lots of websites containing only one page now with the popularity of AJAX. The website will load different contents according to different inputs from users.This approach provides good user experience and it also helps save bandwidth, the drawback is that AJAX contents are not easy to be indexed by search engines. For example, if you have a website:http://example.comUsers can see different contents with the appended # structure in the URL:http://example.com#1http://example.com#2http://example.com#3However, the search engine will only index example.com and ignore the #. To resolve thi...
4,392 0 AJAX GOOGLE HISTORY SEARCH ENGINE
What is pjax and why we should use it?
What is pjax?Now many websites such as Facebook, Twitter support one browsing style which is when you click one link on their sites, the page will not be redirected, instead only the page contents are updated and URL on address bar is changed. This kind of user experience is much better compared to load the whole page with a blink.There is one important component in the above browsing experience, these websites' AJAX refresh support browser history, when refreshing the page, the address on the address bar will also get updated, and when we click back button we can go back to the previous page....
JavaScript cross domain request solution
1. What is cross domain?We may often using AJAX to request data from other domain, now we will have cross domain request issues. It's because JavaScript only allows to request data from the same domain because of security consideration. In short, same domain strategy means a piece of code can read data from the same source, the same source here means the combination of the same domain, protocol and port number.For example:URLDescriptionAllow communication?http://www.a.com/a.js http://www.a.com/b.jsSame domainYeshttp://www.a.com/lab/a.js http://www.a.com/script/b.jsSame domain differe...
4,529 0 SECURITY AJAX CROSS DOMAIN
Commonly used AJAX frameworks
Have you ever wondered to design your website like desktop applications? Fortunately, with AJAX we can achieve this. By using AJAX, we no need to refresh the whole page when we just want to update a portion of a website such as the weather information or news panel. This makes our web apps look like desktop applications and bring good user experience to our visitors. You can create an XMLHttpRequest object every time when you want to initialize an AJAX call, unfortunately you may need repeat every step every time, this is time consuming and brings maintenance overhead. Do you know what kind of...
PHP to get long running process progress dynamically
Frequently in web applications, we may have a request to the back end system which may trigger a long running process such as searching huge amount of data or a long running database process. Then the front end webpage may hang and wait for the process to be finished. During this process, if we can provide the user some information about the progress of the back end process, it may improve user experience. Unfortunately, in web applications, this seems not an easy task because web scripting languages don't support multithreading and HTTP is stateless. We now can have AJAX to simulate rea...
59,916 10 PHP AJAX DEMO PROGRESS LONG PROCESS