Skip to main content

Hello,

Is it possible to cleanup Safari history with a bash or powershell command for iPads?

Why would you do that?
If you use shared iPads, I would use Apple shared iPad technology


No, it's not possible to run scripts of any language on an iPad. The closest thing to a scripting language or tool is the Shortcuts app. 

As pointed out by @RaxiaDK if Safari history or browser history in general is a concern then Shared iPad with either ASM/ABM accounts or guest mode will fulfill that need. 

What is the use case here?


Hello,

 

Thanks for the responds.

We cant use shared iPads.

We are using the iPads in our hospital for our patients. We are using an App where they can watch tv, radio, order food etc. And im giving the option to install other apps like (Netflix, News, Teams etc) But when the patient leaves we resetting the iPads(Normally) Now we have an solution to cleanup all the apps of the iPad and reinstall the required apps, so the iPad is fast done with cleaning and ready to be used again for a new patient. But we cant remove / reinstall Apple Apps. So i thought maybe we can cleanup cache and history for safari, so we don't need a other browser to use. There is also an option to use chrome or firefox (But ive no clue where we can configure the browser settings like a home page etc)

Hope someone has a solution ;)


iPad is a 1:1 device, so the best ting is to reinstall the device evy time.


Hello,

 

Thanks for the responds.

We cant use shared iPads.

We are using the iPads in our hospital for our patients. We are using an App where they can watch tv, radio, order food etc. And im giving the option to install other apps like (Netflix, News, Teams etc) But when the patient leaves we resetting the iPads(Normally) Now we have an solution to cleanup all the apps of the iPad and reinstall the required apps, so the iPad is fast done with cleaning and ready to be used again for a new patient. But we cant remove / reinstall Apple Apps. So i thought maybe we can cleanup cache and history for safari, so we don't need a other browser to use. There is also an option to use chrome or firefox (But ive no clue where we can configure the browser settings like a home page etc)

Hope someone has a solution ;)


Depending on what system you use internally for patient management you can also try the health care listener that can auto wipe iPads when the patient discharges. Jamf Setup and Reset could also technically be used.

https://docs.jamf.com/jamf-setup/configuration-guide/Overview.html

https://docs.jamf.com/jamf-reset/configuration-guide/Overview.html

https://docs.jamf.com/10.38.0/jamf-pro/documentation/Healthcare_Listener.html?hl=healthcare%2Clistener%2Cjamf%2Cpro%2Cdocumentation%2Cjamf

https://www.youtube.com/watch?v=omceYIKlX4w - Based on older versions of HCL and Jamf Pro, so be aware of that.


Depending on what system you use internally for patient management you can also try the health care listener that can auto wipe iPads when the patient discharges. Jamf Setup and Reset could also technically be used.

https://docs.jamf.com/jamf-setup/configuration-guide/Overview.html

https://docs.jamf.com/jamf-reset/configuration-guide/Overview.html

https://docs.jamf.com/10.38.0/jamf-pro/documentation/Healthcare_Listener.html?hl=healthcare%2Clistener%2Cjamf%2Cpro%2Cdocumentation%2Cjamf

https://www.youtube.com/watch?v=omceYIKlX4w - Based on older versions of HCL and Jamf Pro, so be aware of that.


Hello,

 

Yes this can also be an option. But still dont like the whole action of wiping the iPad and getting all the new iPad steps. But think we have a great solution now, and it saves alot of time with getting the iPad ready for a new patient.


No, it's not possible to run scripts of any language on an iPad. The closest thing to a scripting language or tool is the Shortcuts app. 

As pointed out by @RaxiaDK if Safari history or browser history in general is a concern then Shared iPad with either ASM/ABM accounts or guest mode will fulfill that need. 

What is the use case here?


This is wrong. Lots of things can be automated with the cfgutil binary, the Apple Configurator 2 automation tools:

 


This is wrong. Lots of things can be automated with the cfgutil binary, the Apple Configurator 2 automation tools:

 


Cool! You're not mincing your words here are you? To be fair the OP asked about on device scripting. This binary, which can be run in a script, runs on a Mac connected to the iDevices and furthermore only runs within the boundaries of what Apple Configurator and the MDM protocol will allow. Nothing in the MDM protocol currently allows you to act on user data in this manner, so clearing Safari is out of the question. You could certainly automate a wipe and enroll which would achieve a clean device for the next patient. 


Cool! You're not mincing your words here are you? To be fair the OP asked about on device scripting. This binary, which can be run in a script, runs on a Mac connected to the iDevices and furthermore only runs within the boundaries of what Apple Configurator and the MDM protocol will allow. Nothing in the MDM protocol currently allows you to act on user data in this manner, so clearing Safari is out of the question. You could certainly automate a wipe and enroll which would achieve a clean device for the next patient. 


cfgutil 2.15.1 (811) Global options: [-C | --certificate] <argument> Path to DER-encoded certificate of supervising organization. [-K | --private-key] <argument> Path to DER-encoded private key of supervising organization. [-e | --ecid] <argument> Device to act on, by ECID. Can be used more than once. [-f | --foreach] Act on all selected devices. --format <argument> Output format. (text, JSON, plist) --progress Show steps/progress even without plaintext output. --timeout <argument> Set the timeout for detecting connected devices. (in seconds) [-v | --verbose] Increase the logging verbosity. Commands: activate Activate attached devices. add-tags Add tags to devices. backup Take a backup of a prepared iOS device. clear-passcode Clear passcode on a device. (supervised only) erase | erase-content Erase content and settings on devices. (supervised only) exec Run a script when devices attach or detach. get | get-property Show various properties of a device. get-app-icon Save app icons from a device. get-icon-layout Fetch the home screen layout from a device. get-unlock-token Get unlock tokens from supervised devices. help | usage Show help for a command or show all commands. install-app | install-application | install-applications | install-apps Install apps on attached devices. install-doc | install-docs | install-document | install-documents Install documents on attached devices. install-profile | install-profiles Install profiles on attached devices. list | list-devices List attached devices. list-backups List backups stored on the host. pair Try to pair with attached devices. prepare Initial configuration of freshly erased devices. remove-app Remove apps from attached devices. remove-profile Remove profiles from attached devices. remove-tags Remove tags from attached devices. rename | set-name Set the name on a device. restart Reboot attached devices. (supervised only) restore | update Install the latest System version on devices. restore-backup Restore a backup to an iOS device. revive Attempt to revive a device from recovery mode. set-backup-password Set or remove backup passwords on attached devices. set-icon-layout Set home screen icon layout on devices. set-wallpaper | wallpaper Set background image on devices. (supervised only) shut-down Power off attached devices. (supervised only) syslog Print a running output of the device's syslog. unpair Remove pairing between the host Mac and device. version Show this program's version.

I tend to not mince words unless I mean to...

Your answer was incorrect. It kind of still is... You are splitting the hair of "on device scripting". 

See above... You can activate devices, clear passcodes, erase, get device properties, icons, unlock, install & uninstall apps, docs, configuration profiles, restart, restore, restore backups, set passwords, wallpaper, shut down, get logs... which of those actions are not "on device"?


cfgutil 2.15.1 (811) Global options: [-C | --certificate] <argument> Path to DER-encoded certificate of supervising organization. [-K | --private-key] <argument> Path to DER-encoded private key of supervising organization. [-e | --ecid] <argument> Device to act on, by ECID. Can be used more than once. [-f | --foreach] Act on all selected devices. --format <argument> Output format. (text, JSON, plist) --progress Show steps/progress even without plaintext output. --timeout <argument> Set the timeout for detecting connected devices. (in seconds) [-v | --verbose] Increase the logging verbosity. Commands: activate Activate attached devices. add-tags Add tags to devices. backup Take a backup of a prepared iOS device. clear-passcode Clear passcode on a device. (supervised only) erase | erase-content Erase content and settings on devices. (supervised only) exec Run a script when devices attach or detach. get | get-property Show various properties of a device. get-app-icon Save app icons from a device. get-icon-layout Fetch the home screen layout from a device. get-unlock-token Get unlock tokens from supervised devices. help | usage Show help for a command or show all commands. install-app | install-application | install-applications | install-apps Install apps on attached devices. install-doc | install-docs | install-document | install-documents Install documents on attached devices. install-profile | install-profiles Install profiles on attached devices. list | list-devices List attached devices. list-backups List backups stored on the host. pair Try to pair with attached devices. prepare Initial configuration of freshly erased devices. remove-app Remove apps from attached devices. remove-profile Remove profiles from attached devices. remove-tags Remove tags from attached devices. rename | set-name Set the name on a device. restart Reboot attached devices. (supervised only) restore | update Install the latest System version on devices. restore-backup Restore a backup to an iOS device. revive Attempt to revive a device from recovery mode. set-backup-password Set or remove backup passwords on attached devices. set-icon-layout Set home screen icon layout on devices. set-wallpaper | wallpaper Set background image on devices. (supervised only) shut-down Power off attached devices. (supervised only) syslog Print a running output of the device's syslog. unpair Remove pairing between the host Mac and device. version Show this program's version.

I tend to not mince words unless I mean to...

Your answer was incorrect. It kind of still is... You are splitting the hair of "on device scripting". 

See above... You can activate devices, clear passcodes, erase, get device properties, icons, unlock, install & uninstall apps, docs, configuration profiles, restart, restore, restore backups, set passwords, wallpaper, shut down, get logs... which of those actions are not "on device"?


I won’t argue the merits of your response as I’m not into cat and mouse games on Jamf Nation. if I’m wrong, I’m wrong nothing more needs said as the thread has a solution.


Hello,

 

Yes this can also be an option. But still dont like the whole action of wiping the iPad and getting all the new iPad steps. But think we have a great solution now, and it saves alot of time with getting the iPad ready for a new patient.


Hey, what was your solution? TIA


I can tell you what worked for me, what i did was this forced never directly full cache refresh for a specific webpage in Safari on iPhone. However, there are a couple of workarounds you can try to achieve a similar effect:-

Solution 1:- Clear Safari History and Website Data

  • Open the Settings app on your iPhone.
  • Scroll down and tap on Safari.
  • Tap on Clear History and Website Data.
  • A pop-up will confirm your selection. Tap Clear History and Data to proceed.

Note:- This method clears the cache and browsing history for all websites, not just a specific one.

Solution 2:- Private Browsing Mode

  • Open Safari on your iPhone.
  • Tap the aA button in the address bar.
  • Choose Private from the menu.

More effective assistance below.

https://www.youtube.com/watch?v=5CqNeOlDyWg&ab_channel=TheGeekPage