1

Starting with macOS Sonoma, you can use Safari to save any webpage as a web app. I have a website that redirects the URL after you enter the original URL. I'm unable to edit the url domain once the web app is created.

2 Answers 2

0

If you edit the URL in the application bundle , it will no longer have a valid code signature. You may be able to fix that, but it's not trivial.

It is far easier to re-create the Web App with the new URL. You can edit the URL during the creation process. The application is saved to your user directory, at ~/Applications where you can delete the incorrect one before saving a new one, etc.

3
  • You mention I can edit the URL during the creation process. I don't see a way to do that since the URL has already changed to the redirected URL. Am I missing something ?
    – ankitj
    Feb 29 at 0:39
  • @ankitj You can change the path, but not the domain. I suppose if the domain is redirecting then that wouldn't work. Is that the case?
    – Ezekiel
    Feb 29 at 1:27
  • Yes that's the case
    – ankitj
    Feb 29 at 1:42
0

I can think of two methods. The first would be the easiest:

Go to Safari > Settings > Security. Disable Javascript. Visit the url you're interested in. It shouldn't redirect, assuming javascript it what is causing the redirection.

Don't forget to re-enable javascript when you're done!

If that doesn't work, we're gonna hijack the domain :):

Open the Terminal app

Run this command to flush your DNS cache so that the system doesn't already know how to find the destination you want: sudo dscacheutil -flushcache;sudo killall -HUP mDNSResponder

Run this command to temporarily add a host entry that macos will use instead of the actual destination: sudo vi /etc/hosts (if you don't know how to use vi, use nano instead, or really any text editor) add this to the bottom on a new line: 127.0.0.1 the.host.address.you.want.to.use save the file and exit. Note that this is just the name -- like www.google.com and not https://www.google.com/otherstuff

so: 127.0.0.1 www.google.com

Run this to fire up a temporary webserver: mkdir webserver && cd webserver sudo ruby -run -e httpd . -p 80

What that does is spin up a barebones webserver listening on your local computer.

You may get a prompt to let it listen on the network - answer yes (I don't know why this prompt happens since localhost is not reachable outside of your computer).

Open Safari, and go to that url you want to use. You should get mostly blank page from your webserver. At this point you should be able to File, Add to Dock...

Be sure to "CTRL-C" to abort the web server and re-edit your /etc/hosts file to remove that line you added when you're done!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .