Homepage Extension Atribute

jpilege
New Contributor III

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 12

thoule
Valued Contributor II

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

Chuey
Contributor III

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
Legendary Contributor III

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

sean
Valued Contributor

@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.

Chuey
Contributor III

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

thoule
Valued Contributor II

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

jpilege
New Contributor III

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
Esteemed Contributor III

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
--
https://donmontalvo.com

justin_beek
New Contributor III

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.

pleahy
New Contributor

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

nkuhl30
Contributor

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
Release Candidate Programs Tester

This method, still works for me.