You should be able to listen, at the application level, for a beforeNavigate event and then effectively modify the URL by canceling the navigation with preventDefault() and triggering a new load using your rewritten URL.
See also https://developer.apple.com/library/safari/documentation/Extensions/Reference/SafariBeforeNavigateEventClassRef/#//apple_ref/javascript/instp/SafariBeforeNavigateEvent/url -Conrad > On Jan 2, 2016, at 3:07 PM, Rick Mann <rm...@latencyzero.com> wrote: > > That was my first attempt, and it provides no way to modify the main url. > > Sent from my iPhone > > On Jan 2, 2016, at 15:04, Conrad Shultz <conrad_shu...@apple.com > <mailto:conrad_shu...@apple.com>> wrote: > >> >>> On Dec 22, 2015, at 3:51 PM, Rick Mann <rm...@latencyzero.com >>> <mailto:rm...@latencyzero.com>> wrote: >>> >>> You know how you can click links in email, and heck, to open them in Safari >>> (or whatever browser)? Is there any way to write an extension of some sort >>> that can intercept this and re-write the URL? I tried to write a filter in >>> Safari proper for the URL that the user pastes into the address bar, but >>> Safari plug-ins don't have access to that. >>> >>> I want to write a thing to strip all the utm_* parameters off the URLs. >> >> Rather than a plug-in, would a Safari extension do what you need? You might >> take look at >> https://developer.apple.com/library/safari/documentation/Tools/Conceptual/SafariExtensionGuide/WorkingwithWindowsandTabs/WorkingwithWindowsandTabs.html >> >> <https://developer.apple.com/library/safari/documentation/Tools/Conceptual/SafariExtensionGuide/WorkingwithWindowsandTabs/WorkingwithWindowsandTabs.html> >> >> -Conrad _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com