Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Safari 6 integrated an address bar and a search box together. So when you want to search a keyword, you just type into the address box. That's maybe good.

Before, when you type something in the old search box, you were seeing a url that contains all search term as query strings in the old address bar. For example, if you type Safari 6 in the search box, you'll see something like https://www.google.com/search?hl=en&q=safari+6… in the address bar.

In Safari 6, repeating this experiment, type Safari 6 in the integrated address bar. You'll keep seeing Safari 6 there, not the real URL. This happens even if I go to the search site first and type the keyword into their search. It only happens for your choice of the search engine in the Safari preference. So let's say, I pick "Yahoo" and go to "Google.com", then it shows the real URL.

Is it possible to bypass this annoyance and get Safari 6 to reveal the actual URL?

share|improve this question
2  
Wow, why would Safari hijack a site's URL. I would almost classify that as a bug. I really hope for many defaults write secrets for 10.8. –  Arjan Jul 29 '12 at 15:16
    
I cannot easily reproduce Safari hijacking the URL when first going to google.com manually. (Though google.com is used as the search engine in my Safari.) Only when somehow staying on the Google home page while typing (which is hard; normally it goes to the auto search results right away) then clicking the search button does indeed show the search terms in the location bar. –  Arjan Jul 29 '12 at 15:56
    
There's a more recent dupe with a nice drag solution. –  Arjan Aug 11 '12 at 7:52
1  
Yes, I've found this extremely annoying, the straw that switched me over to Chrome. –  Jeff Burdges Sep 9 '12 at 17:50
1  
@CajunLuke, I'm still seeing Safari showing the search words, not the URL. However, Google itself sometimes uses URLs that Safari does not understand. Using the example URL from the question still shows this annoying behavior in my 6.0.1. –  Arjan Oct 3 '12 at 20:09

6 Answers 6

up vote 4 down vote accepted

Safari maintains this information internally, but I've only been able to make it divulge the actual URL by enabling the web inspector (Option-Command-I) after you have enabled the Debug menu at the bottom of the advanced tab in Safari Preferences (Command-,). You can of course drag the URL out of the search window to get a link (instead of copying which just copies the visible search terms).

You will see the Full URL under the Location disclosure in the bottom right corner of your screen. The only good part of this is the text is copyable once you've navigated and selected it. It might be possible to write a Safari extension to perform this copy, but I have not found one to do this yet.

enter image description here

As provided by Arjan you can also make a bookmark and use JavaScript to retrieve the URL.

javascript:(function(){window.location.href=window.location.href.replace("search?", "#");})()

You might also be interested in gDirectLinks or it's more fully fledged sibling LinkThing which change the way Safari renders google search terms and works with URL handling from google.

share|improve this answer
1  
One could even write a simple bookmarklet to run javascript:prompt("Here's your URL", window.location), but I assume the OP just want to get rid of the location bar hijacking...? (And too bad window.location=window.location does not do the trick, though window.location=window.location.replace("search?", "#") does fool Safari.) –  Arjan Jul 29 '12 at 21:59
    
And, once you've bookmarked the javascript of your choice - make it in the first nine slots of your bookmark bar and you can use a command shortcut to invoke it from your keyboard. Third slot -> Command-3. also quixapp.com/help –  bmike Jul 29 '12 at 22:06
    
We'll see. I bet many people will find this answer and your comment and find it useful even if the OP is looking more to hack things and make it the way it was. Hopefully that answer will appear if it's possible. –  bmike Jul 29 '12 at 22:15
    
Er, my last version does not work either. I did when testing ;-) Somehow Stack Exchange sneaked an odd space into the word "search" anyway, even though I was not using `code` to avoid that... Last try, no formatting at all: javascript:(function(){window.location.href=window.location.href.replace("search‌​?", "#");})() –  Arjan Jul 29 '12 at 22:17
    
i didn't think of web inspector. And bookmarklet is a good idea too. thx guys. –  beatak Aug 8 '12 at 4:01

Install the SafariKeywordSearch extension, and this behaviour goes away, but most importantly, you'll get the ability to set other search engines than the ones AAPL has been payed billions to include.

share|improve this answer
    
Installing the extension alone didn't do the job. I also had to change Safaris default search engine from Google to something else (e.g. Bing). Then everything is fine again :) –  Stefan Schmidt Aug 21 '12 at 14:02
    
Okay, one minor annoyance is still left. When opening a new window or tab it now says "Search Bing or enter an adress". I wonder if you can still simply edit Safaris binary with a hex editor to delete that useless string alltogether or if that's now more time-consuming due to code signing. –  Stefan Schmidt Aug 21 '12 at 14:08

I've created a Safari Extension: Get URL to solve this exact issue. It opens a nice popover with the full url, already selected and ready for copying and pasting.

I hope you enjoy it!

share|improve this answer

Right clicking the title of the window shows a menu of the URL you're on. You can't copy from here, but you can SEE the url at least.

share|improve this answer
    
it's a good point, but I want to be able to copy the URL. –  beatak Jul 29 '12 at 21:08

The workaround I use doesn't require downloading extensions and it creates a URL you can copy: in Safari Preferences > Advanced, check "Enable Develop Menu". In the Develop menu, click Show Page Resource. A grey screen appears on bottom third of your monitor, and at extreme right, under "Location", copy the URL.

Another, less sprightly, workaround: add the Google Search Results page as a bookmark, say within a special bookmarks folder created expressly for this purpose (I named mine "Safari Detours"), then right-click to copy the URL from the bookmarks page.

share|improve this answer

It seems that Safari 6.0.1 fixes this.

To quote the release notes:

  • Fix an issue that could cause the Smart Search Field to interpret URLs as search terms.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.