Closed Bug 298169 Opened 20 years ago Closed 10 years ago

When an invalid URL is entered, search using default search engine instead of displaying error

Categories

(Core :: DOM: Navigation, defect)

x86
All
defect
Not set
minor

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: csthomas, Unassigned)

Details

Attachments

(1 file, 1 obsolete file)

If the user enters an invalid url (e.g. "mozilla foundation") we should use that
as input to the default search engine, instead of displaying the invalid URL
message.  This should not occur if the input is something that is already
handled some other way (e.g. adding www. and .com, a bookmark keyword search, etc).

It should default to being pref'd off, because I think most users would find it
confusing that "mozilla" takes them to www.mozilla.org while "mozilla
foundation" results in a google search.

For me, this is most useful when I simply forget to hit "up" before hitting
enter while trying to do a search from the URL bar.
Status: NEW → ASSIGNED
Target Milestone: --- → Seamonkey1.0alpha
Attached patch patch (obsolete) — Splinter Review
Attachment #186739 - Flags: review?(cbiesinger)
Attachment #186739 - Attachment is obsolete: true
Attachment #186739 - Flags: review?(cbiesinger)
Assignee: cst → adamlock
Status: ASSIGNED → NEW
Component: General → Embedding: Docshell
Product: Mozilla Application Suite → Core
QA Contact: general → adamlock
Target Milestone: Seamonkey1.0alpha → ---
Assignee: adamlock → cst
Comment on attachment 186739 [details] [diff] [review]
patch

so, this patch's approach is probably ok, since internet keywords also affect
single words typed into the urlbar. hm.. although, maybe a new nsIURIFixup flag
would be better?
Attachment #186739 - Attachment is obsolete: false
Attachment #186739 - Attachment is obsolete: true
Attachment #188008 - Flags: review?(cbiesinger)
Status: NEW → ASSIGNED
Whiteboard: [cst:r?]
Comment on attachment 188008 [details] [diff] [review]
patch with less colorful language

+	 if (mPrefs &&
NS_SUCCEEDED(mPrefs->GetBoolPref("browser.search.searchIfInvalidURL",
&shouldSearch))

please try to keep lines under 80 columns... and oeprators should be put at the
end of lines. maybe:

	if (mPrefs &&
	   
NS_SUCCEEDED(mPrefs->GetBoolPref("browser.search.searchIfInvalidURL",
					     &shouldSearch)) &&

although that still doesn't quite fit.

I'm not sure that the pref name is great... but I have no better suggestion

r=biesi with that line length change
Attachment #188008 - Flags: superreview?(bzbarsky)
Attachment #188008 - Flags: review?(cbiesinger)
Attachment #188008 - Flags: review+
Doesn't firefox already do this, without the docshell hook?  Does that mean that
they have some sort of hack that could be removed in favor of this pref now?
(In reply to comment #5)
> Doesn't firefox already do this, without the docshell hook?  Does that mean that
> they have some sort of hack that could be removed in favor of this pref now?

Firefox does already do this, and I see a bunch of code lying around in docshell
to handle this, so wouldn't it be somewhat trivial to make it work for Seamonkey?

See 
http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/docshell/base/nsDefaultURIFixup.cpp#264
http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/docshell/base/nsDefaultURIFixup.cpp#693
and bug 261608, bug 245597.
I suspect this patch breaks alt+enter on SeaMonkey.
Comment on attachment 188008 [details] [diff] [review]
patch with less colorful language

sr- pending response to comment 5.
Attachment #188008 - Flags: superreview?(bzbarsky) → superreview-
(In reply to comment #8)
> (From update of attachment 188008 [details] [diff] [review] [edit])
> sr- pending response to comment 5.

Firefox does an "I'm feeling lucky" search when you type multiple words in the 
URL bar.
Whiteboard: [cst:r?]
(In reply to comment #9)
> Firefox does an "I'm feeling lucky" search when you type multiple words in the 
> URL bar.

I'd be very much against that and for a normal search instead for SeaMonkey...
what url is loaded is a pref...
(In reply to comment #11)
> what url is loaded is a pref...
...which shouldn't default to I'm Feeling Lucky.
> Firefox does an "I'm feeling lucky" search when you type multiple words in the 
> URL bar.

Sure.  So all it's doing is opening some URL defined by the app, right?  Why
can't you do the same, with the URL coming from whatever prefs we have set to
pick the default search engine?

Put another way, how is "google I'm feeling lucky search" anything other than
"default search engine" for Firefox?
Not much different. Except the searches in the search bar are defined by mycroft
plugins, while the keyword search from the url is simply appended to a url taken
from a pref.

Also note there are a couple of bugs in firefox's handling of this feature: bug
245597 and bug 295991

-> someone else
Assignee: cst → nobody
Status: ASSIGNED → NEW
QA Contact: adamlock → docshell
I've wished for this for some time in Mozilla/Seamonkey. If I hadn't found this bug, I was going to submit one, asking that the presence of a space character be used to filter, so "mozilla" might resolve to mozilla.com, while "mozilla browser" would produce a search for both words.

Didn't realize until reading here that FF does this already, except it's an "I feel lucky" search, which is almost worthless. After some looking, I found that this can be fixed by changing the value of "keyword.URL" from this:
http://www.google.com/search?btnI=I%27m+Feeling+Lucky&ie=UTF-8&oe=UTF-8&q=
to this:
http://www.google.com/search?ie=UTF-8&oe=utf-8&q=

Better, but doesn't help me, since I dislike FF. But I wondered: could I enable the FF behaviour in Seamonkey simply by editing preferences? Turns out that I can. By changing "keyword.enabled" from false to true, Seamonkey behaves as this bug asks, unless I misunderstand it. I'm happy, at least.

My next thought was to make this configuration option more accessible, with a checkbox description reading something like "treat multiple words in location bar as search terms". But again, I found that I'm behind. There already is a setting to do that under "Smart Browsing": "Enable Internet Keywords". Not as descriptive as I'd like, but it *is* there. So why isn't it on by default? Looks like that question leads to another bug:
http://bugzilla.mozilla.org/show_bug.cgi?id=197918
I think we are pretty good at doing this these days, and so I'm closing WFM - please file new bugs with more specifics if there are cases that we still get wrong / that don't work.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: