{"id":41412,"date":"2023-12-11T15:00:43","date_gmt":"2023-12-11T20:00:43","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=41412"},"modified":"2023-12-11T15:00:43","modified_gmt":"2023-12-11T20:00:43","slug":"opening-urls-in-private-safari-windows","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2023\/12\/11\/opening-urls-in-private-safari-windows\/","title":{"rendered":"Opening URLs in Private Safari Windows"},"content":{"rendered":"<p><a href=\"https:\/\/underpassapp.com\/news\/2023-11-27.html\">Jeff Johnson<\/a>:<\/p>\n<blockquote cite=\"https:\/\/underpassapp.com\/news\/2023-11-27.html\"><p>The problem with using both private and public windows is that when I open a URL in Safari from another app, such as Mail app, or such as my own <a href=\"https:\/\/underpassapp.com\/LinkUnshortener\/\">Link Unshortener<\/a>, which I use as my default web browser, I can&rsquo;t control where exactly the URL opens. If the frontmost Safari window happens to be private, then the URL will open in a private window, whereas if the frontmost Safari window happens to be public, then the URL will open in a public window. Even worse, if Safari is running but currently has no windows, then the URL will open in a new public window, ignoring my &ldquo;Safari opens with&rdquo; setting!<\/p><p>I&rsquo;ve come up with a solution to this problem. Actually, two solutions, two new Mac apps, which I&rsquo;ve named, with great imagination, <a href=\"https:\/\/github.com\/lapcat\/PrivateWindow\">PrivateWindow and PublicWindow<\/a>.<\/p><\/blockquote>\n\n<p>I&rsquo;ve set PrivateWindow as the browser associated with certain logins in <a href=\"https:\/\/www.selznick.com\/products\/passwordwallet\/\">PasswordWallet<\/a>. Among other benefits, this means I can download a financial statement and then &ldquo;log out&rdquo; simply by closing the tab.<\/p>\n\n<p><a href=\"https:\/\/underpassapp.com\/news\/2023-12-9.html\">Jeff Johnson<\/a>:<\/p>\n<blockquote cite=\"https:\/\/underpassapp.com\/news\/2023-12-9.html\"><p>Since Apple doesn&rsquo;t provide any API for this, the apps use <a href=\"https:\/\/developer.apple.com\/library\/archive\/documentation\/AppleScript\/Conceptual\/AppleScriptLangGuide\/introduction\/ASLR_intro.html\">AppleScript<\/a> to automatically click menu items in the Safari File menu in the main menu bar, a primitive but effective method. Or mostly effective. It turns out that this method didn&rsquo;t support Safari Profiles, which add items to the Safari File menu. The shortcoming has been rectified in version 2.0 of PrivateWindow and PublicWindow.<\/p><\/blockquote>\n<p>Apple should add a real AppleScript API so that this sort of thing can be done without GUI scripting. You should be able to directly specify whether a URL should be opened in a private or public window and which profile should be used. Really, it should also be available at the Launch Services level. Currently, there&rsquo;s a <a href=\"https:\/\/developer.apple.com\/documentation\/appkit\/nsworkspaceopenconfiguration\">standard way<\/a> to specify whether an application should open a URL in the background or whether a file should not be added to the recents. Private browsing should be in there, too.<\/p>","protected":false},"excerpt":{"rendered":"<p>Jeff Johnson: The problem with using both private and public windows is that when I open a URL in Safari from another app, such as Mail app, or such as my own Link Unshortener, which I use as my default web browser, I can&rsquo;t control where exactly the URL opens. If the frontmost Safari window [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2023-12-11T20:00:45Z","apple_news_api_id":"be59276d-1e6c-48ad-8ff9-800024620fe8","apple_news_api_modified_at":"2023-12-11T20:00:45Z","apple_news_api_revision":"AAAAAAAAAAD\/\/\/\/\/\/\/\/\/\/w==","apple_news_api_share_url":"https:\/\/apple.news\/AvlknbR5sSK2P-YAAJGIP6A","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[2],"tags":[159,30,32,74,1537,103,96],"class_list":["post-41412","post","type-post","status-publish","format-standard","hentry","category-technology","tag-applescript","tag-mac","tag-macapp","tag-opensource","tag-passwordwallet","tag-safari","tag-web"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/41412","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=41412"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/41412\/revisions"}],"predecessor-version":[{"id":41413,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/41412\/revisions\/41413"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=41412"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=41412"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=41412"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}