سؤال

I'd like to suppress Firefox's "Add a Keyword for this Search" context-menu (right-click) item which appears (inappropriately) on certain input elements, e.g.:

<form method="post">
  <!-- the following will have an inappropriate context-menu entry -->
  <input type="text" />
</form>

As far as I've been able to tell, the context menu entry appears by default on any input inside a form. It appears on any "text-ish" input type, including text, number, tel, email, and (of course) search.

JSFiddle

I'm in ASP.NET so I can't remove the form or change its method. Any other options are OK.

هل كانت مفيدة؟

المحلول

If you add enctype="multipart/form-data" to your <form> element, then Firefox will not include "Add a Keyword" in the context menu:

<form method="post" enctype="multipart/form-data">
  <input type="text" />
</form>

This is due to a limitation in Firefox; see this code for details. If this limitation is fixed, this workaround might stop working in future versions of Firefox.

The "Add a Keyword for this Search" menu item is a standard feature of Firefox, and might even be useful to some of your users in some cases, so I would also recommend just ignoring it if it's not actively harming your site.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top