can any body tell me how i create a .txt file using javascript which is browser compatable too.
and after creating the file it gives the save as diaglog box so that
One may indeed initiate data URL downloads, including in a way to prompt a file dialog (though not with a default path or even file type). See https://stackoverflow.com/a/13696029/271577 for such a solution (along with text link examples). That being said, opening the content in a new tab via data URLs may be a better solution if you can get users to manually save using their browser.