Skip to main content
Question

Homepage Extension Atribute

  • June 13, 2016
  • 12 replies
  • 34 views

Forum|alt.badge.img+8

We pushed out a new homepage to our company Macs. We pushed out a terminal command that changed Safari and Firefox homepages and a pkg for Chrome homepages.

We are now looking for an EA that will detect the homepage of each browser to make sure everything went through successfully. I've tried looking around and haven't seen anything that will work.

Anyone have any suggestions?

12 replies

Forum|alt.badge.img+15
  • Contributor
  • June 13, 2016

That's not going to be simple, as that's a user account based setting. So if you have multiple users, you'll need to loop through each one- unless all computers have the same user name on them! And do that for Firefox and Safari.

Two easier ways to set the home page are either create a profile to set it, or use your JAMF tool

/usr/local/jamf/bin/jamf setHomePage -feu -fut -homepage http://homepage/url/here

Forum|alt.badge.img+10
  • Valued Contributor
  • June 14, 2016

I wrote this small EA to read Safari Homepage for specific computers in my environment:

#!/bin/bash

checkHome=`/usr/bin/defaults read com.apple.Safari HomePage`

echo "<result>$checkHome</result>"

mm2270
Forum|alt.badge.img+24
  • Legendary Contributor
  • June 14, 2016

@Chuey You do realize in your EA that it will be reading the Safari preferences for the root account only, right?


Forum|alt.badge.img+12
  • Contributor
  • June 14, 2016

@thoule You can use wildcards when using find:

find /Users/*/Library/Preferences -maxdepth 1 -name com.apple.Safari.plist -exec defaults read {} HomePage 2>/dev/null ;

@jpilege For Safari, profile/mcx would make sense. Of course Firefox can be managed too. There's plenty of threads about that on this forum and Mozilla have pages on this too. For example, you could use defaultPref or lockPref for "browser.startup.homepage", "startup.homepage_override_url", "startup.homepage_welcome_url" in a mozilla.cfg file and push this when you push Firefox.

If you wish to report on success of a script with an EA, it may be wise to include in the script a section that builds a plist for you on completion and then set an EA to read this custom plist.


Forum|alt.badge.img+10
  • Valued Contributor
  • June 14, 2016

@mm2270 Yes, this is only a snippet of how I was reading the homePageURL.


Forum|alt.badge.img+15
  • Contributor
  • June 14, 2016

@sean - I hadn't thought of using find. I always used to do a for loop through the users. Nice trick. thx


Forum|alt.badge.img+8
  • Author
  • Contributor
  • June 14, 2016

I tried using MCX, but it would be successful on a few computers and then fail on others. I was able to scope out a custom policy with this command in it to change the homepage for Safari and Firefox.

sudo jamf setHomePage -homepage homepage.com -feu -fut

With Chrome, I sent out a package with the changes to the Master and Default profile preference files. During my testing and push to production Macs, I didn't have any issues.

Some of our Macs travel or work from home a lot. I've seen in my testing that the policy can say success, but no changes appeared on the computer. With an EA, I can track who has the new homepage and who doesn't for reassurance that everything is good.

Thanks for everyone's reply and feedback!


donmontalvo
Forum|alt.badge.img+36
  • Hall of Fame
  • June 29, 2016

Worked on a related task today, EA to show Firefox ESR homepage. So I thought I'd share. Thank you @mm2270 and @stevewood and Google for all the help...good practice.

#!/bin/sh
CONFIGFILE="/Applications/Firefox.app/Contents/Resources/mozilla.cfg"
HOMEPAGE=`cat /Applications/Firefox.app/Contents/Resources/mozilla.cfg | grep -Eo '(http|https)://[^/"]+'`
if [ -e $CONFIGFILE ] ; then
    echo "<result>$HOMEPAGE</result>"
else
    echo "<result>NotSet</result>"
fi

Forum|alt.badge.img+6
  • Contributor
  • July 12, 2016

Any luck with this lately? Like on Safari 9.1.1?

We can run the command to set it and run the command to verify/test it - looks good.
But it never really changes it.

If you look in Safari, it keeps the old Homepage.

Strangely, if I manually set the HomePage to XXXXXXXX, when I open the Safari plist, there is no XXXXXXXX anywhere.


Forum|alt.badge.img+1
  • New Contributor
  • August 12, 2016

The Homepage seems to be in com.apple.internetconfigpriv.plist now.


Forum|alt.badge.img+7
  • Contributor
  • August 25, 2016

com.apple.internetconfigpriv.plist looks as if it holds the homepage from the surface, but it actually doesn't. Changing the homepage in Safari yields no effect on this plist file. My guess is that the homepage is being encrypted somewhere for security purposes, possibly to fill a security hole. The only way to set it for an image is to use a profile.


bentoms
Forum|alt.badge.img+35
  • Hall of Fame
  • August 25, 2016

This method, still works for me.