Question: Say I have an array of user selected files.

In my application, each selected file corresponds to a person. Once the user selects the files, a table appears. In the left column is each file's name. In the right hand column, the user must fill in the name of the relevant person. Once all the names are filled in the user can upload the files. As there could be hundreds of names to fill in, I would like to be able to save the user's progress to localStorage periodically, in case the page refreshes.

I can pass each file object (var **thisFile**) to an uploading script and the browser will know where to locate the file.

However, I would like to be able to save the list of selected files in localStorage, and JSON.stringify will strip out a file object.

So say I first create a javascript object based on the file object (var **file** below).

If I then pass var **file** to the uploading script, will the browser still be able to locate the file, or would the full path to the file have been lost? 

```js
for (var i = 0; i < userSelectedFiles.length; i++) {
  //File object (Stripped out by JSON.stringify).
  var thisFile = userSelectedFiles[i];
  //Create a javascript object based on the file object (Not stripped out by JSON.stringify).
  var file: {
    'lastModified': thisFile.lastModified,
    'lastModifiedDate': thisFile.lastModifiedDate,
    'name': thisFile.name,
    'size': thisFile.size,
    'type': thisFile.type
  },
}
```

Answer: 
You can check for the existence of one string within another by using `indexOf()`. Try this:

```
var loc = window.location.href;
if (localStorage.reloaded !== 'true' && (loc.indexOf('string-1') != -1 || loc.indexOf('string-2') != -1)) {
    setTimeout(function(){
        $('body').fadeOut(2000, function(){
            localStorage.reloaded = 'true';
            location.reload(true);
        });
    }, 5000); // 5 seconds for demo
}

```
try this......

```
$(function(){

if(window.location.href.indexOf("string-1")!=-1)
    {
$('body').fadeIn(1000);
    if (localStorage.reloaded !== 'true') {
        setTimeout(function(){
            $('body').fadeOut(2000, function(){
                localStorage.reloaded = 'true';
                location.reload(true);
            });
        }, 5000); // 5 seconds for demo
    }

}
});

```