Showing posts with label jQuery. Show all posts
Showing posts with label jQuery. Show all posts

There are many ways to clear the localStorage of your web browser.

In a common dev toolbar just type:
localStorage.clear();
If you are using jQuery:
$.storage('clear');
If you are using Sencha:
// proxy
var store = Ext.getStore('YourStore');
store.getProxy().clear();
store.data.clear();
store.sync();

// no proxy
var store = Ext.getStore('YourStore');
store.removeAll();
store.sync();
You can also delete the localStorage via a bookmark. Just add the following snippet as new bookmark:
javascript:(function(){localStorage.clear()})();

AJAX-Requests for local files are not working on Google Chrome.
XMLHttpRequest cannot load file:///Users/… . Origin null is not allowed by Access-Control-Allow-Origin
To bypass, either use a HTTP server or start Google Chrome with a command-line switch. Open the Terminal and type the command below:
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --allow-file-access-from-files
If you receive a message like:
XMLHttpRequest cannot load ... Cross origin requests are only supported for HTTP.
Open the Terminal and type the command below:
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --disable-web-security

As long as web security is disabled, it is not recommended to surf on public internet pages. In this mode your web browser is vulnerable for any kind of cross-site scripting.

For more information about Google Chrome command-line switches, take a look at Google Chrome command line switches.
ICEfaces is based on Prototype JavaScript-Library, but what when you want to use jQuery in your project too? - The trick is to define separate namespaces for each library, to prevent them from a clash.

The code snipped below shows how to do that:

<html>
 <head>
   <script src="prototype.js"></script>
   <script src="jquery.js"></script>
   <script>
     var $j = jQuery.noConflict();
     
     // Use jQuery via $j(...)
     $j(document).ready(function(){
       $j("div").hide();
     });
     
     // Use Prototype with $(...), etc.
     $('someid').hide();
   </script>
 </head>
 <body></body>
 </html>

For more details go to http://docs.jquery.com/Using_jQuery_with_Other_Libraries .