JavaScript Chrome Extensions onDeterminingFilename syntax

I have created a simple extension for use on a clients pc to add a save image option to the context menu. Googles Chrome extension documentation, plus examples quoted on the web, leads me to believe I can specify a subdirectory of the 'Downloads' folder as the download target, using 'filename' in the 'onDeterminingFilename' Event.

But I can't figure the syntax. Heres the listener with my pseudo code after 'filename':

chrome.downloads.onDeterminingFilename.addListener(function(item, suggest) {
suggest({filename: mysubdirectory + item.filename});
});

I've tried including mysubdirectory in quotes and with escaped characters, but with no change. The listener works as I've used filename: 'new name' to test it. I'm sure is very very simple, or maybe I've misunderstood the Event. Thanks.

Answer:1

I've looked at a lot of similar questions about this kind of problem but they haven't solved my problem... This is the string that I've to match: "|6[1]|" where the "6" is a variable that I've to put ...

I've looked at a lot of similar questions about this kind of problem but they haven't solved my problem... This is the string that I've to match: "|6[1]|" where the "6" is a variable that I've to put ...

  1. variable inside javascript string
  2. variable inside javascript
  3. variable inside regex javascript
  4. php variable inside javascript
  5. variable inside function javascript
  6. variable inside class javascript
  7. variable inside object javascript
  8. variable inside array javascript
  9. variable inside quotes javascript
  10. variable inside text javascript
  11. twig variable inside javascript
  12. php variable inside javascript function
  13. variable inside foreach javascript
  14. php variable inside javascript alert
  15. variable inside loop javascript
  16. jsp variable inside javascript
  17. razor variable inside javascript
  18. global variable inside javascript function
  19. smarty variable inside javascript
  20. access variable inside javascript function

Is it possible to pass a named function with parameters to a jquery function as an argument instead of an anonymous function. This is what I'm trying to do: $('body').bind("click", saySomething); ...

Is it possible to pass a named function with parameters to a jquery function as an argument instead of an anonymous function. This is what I'm trying to do: $('body').bind("click", saySomething); ...

  1. pass named function javascript
  2. elixir pass named function as argument
  3. javascript pass named function as parameter
  4. pass named range vba function

I know there is the True/False option for this, but I'm wanting to have it differentiate depending on the status of a document. It only lets you select Edit or Read Only on the "Display" tab, but I'm ...

I know there is the True/False option for this, but I'm wanting to have it differentiate depending on the status of a document. It only lets you select Edit or Read Only on the "Display" tab, but I'm ...

My if statement evaluates only 1st condition, second one after || is overlooked. How to fix this? function validateAge(input) { if ((input.value < 0 || input.value > 110) || (input.value....

My if statement evaluates only 1st condition, second one after || is overlooked. How to fix this? function validateAge(input) { if ((input.value < 0 || input.value > 110) || (input.value....