How to allow Javascript from the Smart Search Field in Safari

Posted by | November 12, 2013 | Tech and Tricks | 2 Comments

One of the latest discoveries I’ve done is that Safari does not allow, by default, javascript code in the Smart Search Field. To be honest, I do not know if is a new security measure, what I know is that before the installation of Mavericks (OSX 10.9) I was able to do it, now I’m not any more.

This is a quick screenshot of the error message I’ve got.

safari-smart-search-javascript

First step: how to show develop menu in Safari

To show develop menu in Safari I need to go in the browser’s preferences, by clicking on Safari -> Preferences using the top menu or by simply clicking cmd + comma on the keyboard (how much I love shortcuts…)

Once done, go in Advanced field and then tick “Show develop menu in menu bar”, as shown in the picture below.

safari-how-to-show-develop-menu

Second step: allow Javascript from the Smart Search Field

As magic we have the “Develop” menu in the top menu of our Mac. All we need to do is click on the last line, as shown in the pic below.

allow-javascript-in-smart-search-field-menu

Third step: enjoy

Now we can use javascript in the Smart Search Field in Safari, which is useful, for example, to obtain coordinates from a Google Maps using this code:

javascript:void(prompt(”,gApplication.getMap().getCenter()))

Here is the final result:

safari-smart-search-javascript-ok

If it seems not to work, try to restart Safari and try again.

Eeeeeeeenjoy!!

About gijno

2 Comments

Leave a Reply

Your email address will not be published.