Fedora web server - CHAPTER 2 THE NUTS AND BOLTS OF

CHAPTER 2 THE NUTS AND BOLTS OF AJAX 45 In this example, the button calls the function StartItNonEnding. In the function StartItNonEnding, there is a single method call, window.setInterval. The method setInterval has multiple variations, and a valid variation is like setTimeout illustrated previously. The variation illustrated in the HTML code uses three parameters, even though only two are necessary. The first parameter is a reference to a function that is called for each periodic event. The second parameter is the length of the period. And the third parameter is an argument that is passed to the function NeverEnding. The third parameter does not work in Internet Explorer, but works on other browsers such as Firefox and Safari. As in the one-shot timer, the timer output is inserted into the HTML document. The counter is incremented for each call to the function NeverEnding. What is different is that NeverEnding has a parameter that can be used to uniquely identify an instance of the timer. To stop a periodic timer, the method clearInterval is used. The parameter for clearInterval is the value of the instantiated timer that is returned when calling the method setInterval. After running the HTML code, the generated output is similar to Figure 2-11. The value 10 in the lower-right corner of the HTML table is the value passed to the function NeverEnding. The 0 value is the counter. Figure 2-11. Generated HTML document Calling Domains Other Than the Serving Domain When an HTML page is downloaded from one domain, the XMLHttpRequest object can download content only from that domain. So if the page is downloaded from devspace.com, content can be downloaded only from devspace.com. Attempting to download content from another domain will generate an error similar to that in Figure 2-12 regardless of the browser. The error is permission related and is a consequence of the same origin policy, and not a programmatic error. A permission error indicates that something is being attempted that may be possible under different circumstances. The error is used to prevent the cross-site scripting vulnerability. What needs to be modified are the permissions on the browser.
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision web and email hosting services

Leave a Reply