20

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?

7
  • 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
    Commented Jul 29, 2012 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
    Commented Jul 29, 2012 at 15:56
  • There's a more recent dupe with a nice drag solution.
    – Arjan
    Commented Aug 11, 2012 at 7:52
  • 2
    Yes, I've found this extremely annoying, the straw that switched me over to Chrome. Commented Sep 9, 2012 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
    Commented Oct 3, 2012 at 20:09

8 Answers 8

7

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.

5
  • 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
    Commented Jul 29, 2012 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
    Commented Jul 29, 2012 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
    Commented Jul 29, 2012 at 22:15
  • 1
    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
    Commented Jul 29, 2012 at 22:17
  • i didn't think of web inspector. And bookmarklet is a good idea too. thx guys.
    – beatak
    Commented Aug 8, 2012 at 4:01
5

A really simple way I discovered to get around this is this (btw, I'm using Safari 7.1):

  1. "Select all" in the address box
  2. Open a new Safari window
  3. Click in the address box and "paste"

This gives you a URL (a really long URL) you can then drag off and save into a folder, paste elsewhere for reference, etc.

2
  • not working anymore
    – IceFire
    Commented Oct 9, 2018 at 9:02
  • Did work for me. Today's Last Safari regular version: 14.0 (15610.1.28.1.9, 15610
    – Martin
    Commented Nov 4, 2020 at 10:03
4

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.

2
  • 2
    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 :) Commented Aug 21, 2012 at 14:02
  • 1
    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. Commented Aug 21, 2012 at 14:08
3

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!

1
  • 1
    I loved your plugin. However, it's been removed by Safari 12.
    – Sparky
    Commented Sep 19, 2018 at 16:13
2

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.

3
  • 2
    it's a good point, but I want to be able to copy the URL.
    – beatak
    Commented Jul 29, 2012 at 21:08
  • This is a good Idea. So I think the canon version of this trick is Apple-clicking the title of the window. Commented Dec 23, 2014 at 15:03
  • The current (non beta) build of safari now has an option to show the full url, natively.
    – Alexander
    Commented Dec 23, 2014 at 15:14
2

OMFG I discovered the answer to this by accident.

Just select the text in the search/URL field and Copy it. That's all. The Google url, not the search text, will be copied to the clipboard. Simple as that.

Edit: As a commenter pointed out, this works only after you have executed the Search.

3
  • not working anymore
    – IceFire
    Commented Oct 9, 2018 at 9:02
  • @IceFire in what OS and Safari version?
    – Calion
    Commented Oct 10, 2018 at 14:36
  • 2
    10.14, 12.0; the point is that visiting the site and copying works, but without visiting the site, copying will just copy the search text
    – IceFire
    Commented Oct 11, 2018 at 7:51
0

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.

0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .