Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

How can I refer to a filename with a # in it (e.g. A#.png)? Note: "./A#.png" doesn't work.

  • 3 replies
  • 3 have this problem
  • 3 views
  • Last reply by cor-el

more options

Is there a way to get Firefox to load a file when the file name includes the character "#".

I use #'s in filename's to represent musical key signatures, and want to continue to do so.

I've tried using "& # 35 ;" (without the intervening spaces) in place of the #'s but this doesn't work.

Neither of the following file references work with FireFox (both work with IE) ...

   ... src="./A& # 35 ;.png" ...       <=  (without the intervening spaces)

   ... src="./A#.png" ...

Modified by JimBayne

Chosen solution

The hash (#) is used to specify an anchor name or id in the file.
You need to escape such characters if they are part of the name: A%23.png

javascript:var p='%s';do;while(p=prompt(escape(p),p));
Read this answer in context 👍 1

All Replies (3)

more options

Chosen Solution

The hash (#) is used to specify an anchor name or id in the file.
You need to escape such characters if they are part of the name: A%23.png

javascript:var p='%s';do;while(p=prompt(escape(p),p));
more options

Many thanks cor-el! That works perfectly.

more options

You're welcome.

You may also need to use encodeURIComponent in some cases:

javascript:var p='%s';do;while(p=prompt(encodeURIComponent(p),p));

Modified by cor-el