internet explorer - Javascript code not accepted by validator (JSHint) -
i've written code display bookmarks in ie8. check i've used jshint , following errors :
- var files=new enumerator(favfolder.files); 'enumerator' not defined. (line 14)
- enumerator(favfolder.subfolders); 'enumerator' not defined. (line 34)
- activexobject("scripting.filesystemobject"); 'activexobject' not defined. (lines 46)
- activexobject("wscript.shell"); 'activexobject' not defined. (line 50)
does know why ?
my code :
var i=0; var favstring=""; var fso; function getfavourites(folder) { var favfolder=fso.getfolder(folder); //gets favourite names & url's given folder. var files=new enumerator(favfolder.files); for(; !files.atend() ;files.movenext()) { var fil=files.item(); if(fil.type=="internet shortcut") { var textreader=fso.opentextfile(fil.path,1,false,-2); var favtext=textreader.readall(); var start=favtext.indexof("url",16); var stop=favtext.indexof("\n",start); favstring+=fil.name.replace(/.url/,""); favstring+=":url:"; //to separate favourite name & favorite url favstring+=favtext.substring(start+4,stop-1); favorites.innerhtml+=favstring; favstring+=":next:"; //to separate favorites. i++; } } //checks subfolder exists var subfolders=new enumerator(favfolder.subfolders); for(; !subfolders.atend() ;subfolders.movenext()) { var folder=subfolders.item(); getfavourites(folder.path); } } function import() { try { fso=new activexobject("scripting.filesystemobject"); if(fso !==null ) { //create windows script shell object access favorites folder in user system. var object=new activexobject("wscript.shell"); var favfoldername=object.specialfolders("favorites"); if(favstring==="") { getfavourites(favfoldername); } } } catch(err) { alert("security settings modified in browser "); } }
jslint commonly javascript in browsers, not ie specified, enumerator
, activexobject
or other browser specified objects not supported.
if developing ie only, ignore these warnings.
also, may add enumerator, activexobject
in predefined textbox.
Comments
Post a Comment