skip to Main Content

How to change the title in window.showSaveFilePicker() function.

enter image description here

async function getNewFileHandle() {
  const opts = {
    types: [
      {
        description: "Text file",
        accept: { "text/plain": [".txt"] },
      },
    ],
  };
  return await window.showSaveFilePicker(opts);
}
getNewFileHandle();

2

Answers


  1. You can’t. This is shown as a security measure for the user, not for you to put any description inside this. Maybe this will change in the future, but for now there is simply no option to do so. You can see all options which are supported on the MDN documentation.

    Login or Signup to reply.
  2. You can’t. Currently the ‘showSaveFilePicker’ only allows you to customize ‘excludeAcceptAllOption’, ‘id’, … (See: https://developer.mozilla.org/en-US/docs/Web/API/Window/showSaveFilePicker#excludeacceptalloption). This dialog is alos very specific to the Operation System and the message displayed at the top is a warning for the user. So there is a high chance, that the browser won’t allow you to customize it.

    Since the API is still experimantal, this might change in the future, but now you just can’t.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search