Safari Pop-up whitelist?

MatG
Contributor III

Hi,

Is it possible to set certain websites to always allow pop-ups via a script we can push out via Jamf?

3 REPLIES 3

PatrickD
Contributor II

Hey @MatG, did you ever find a solution to this? We are looking to block pop-ups in Safari except for those that we specify.

We are trying to do this through a Config Profile.

MatG
Contributor III

@PatrickD Hello, not really. I spoke with Apple Professional Service and they told me its not possible but there is script we tried out but it only had about a 60-70% success rate. swap Just out where it says YOURURL and  ANOTHERURL

#!/bin/sh

loggedInUser=`python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "\n");'`
echo $loggedInUser
sudo -u $loggedInUser echo 'insert into preference_values (domain,preference,preference_value) values ("YOURURL","PerSitePreferencesPopUpWindow",2)'|sqlite3 /Users/$loggedInUser/Library/Safari/PerSitePreferences.db
sudo -u $loggedInUser echo 'insert into preference_values (domain,preference,preference_value) values ("ANOTHERURL","PerSitePreferencesPopUpWindow",2)'|sqlite3 /Users/$loggedInUser/Library/Safari/PerSitePreferences.db

RamosC
New Contributor II

Hello! When I attempted this, I swapped out YOURURL and ANOTHERURL with the pop-up URL.

 

I am getting the following error:

"Error near line 1: UNIQUE constraint failed: preference_values.domain, preference_values.preference"

 

Any suggestions on how to resolve this? I have no idea how to script or where to even begin.

Thank you! 🙂