<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi!<div class=""><br class=""></div><div class="">As per Jacob’s request, here’s our exchange regarding building an HTTPS Everywhere Safari extension.<div class=""><br class=""></div><div class="">The threaded quotes are in reverse chronological order. I hope that’s bearable.</div><div class=""><br class=""></div><div class="">- Chris.</div><div class=""><br class=""></div><div class=""><div class="" style="font-family: HelveticaNeue;">Chris Aljoudi</div><div class="" style="font-family: HelveticaNeue;">Design. UI/UX. Technology.</div><div class="" style="font-family: HelveticaNeue;">Web: <a href="https://chrismatic.io/" class="">https://chrismatic.io/</a></div><div class="" style="font-family: HelveticaNeue;">Google Voice: +1 (719) 344-2483</div></div><div class=""><div><br class=""><blockquote type="cite" class=""><div class="">Begin forwarded message:</div><div class=""><div class="quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><font face="HelveticaNeue" class=""><br class=""></font></div></div></blockquote></div></div></blockquote><br class=""><blockquote type="cite" class=""><div class=""><div class="quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div class=""><div class=""><blockquote type="cite" class=""><div class="">On Nov 11, 2014, at 6:54 PM, Jacob S Hoffman-Andrews <<a href="mailto:jsha@eff.org" class="">jsha@eff.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: HelveticaNeue; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">This is great! Mind re-posting to the list for posterity, then I'll follow up there?</span><br style="font-family: HelveticaNeue; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: HelveticaNeue; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">On 11/11/2014 05:47 PM, Chris Aljoudi wrote:</span><br style="font-family: HelveticaNeue; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: HelveticaNeue; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">Hi Jacob!<br class=""><br class="">/beforeNavigate/ doesn’t fire for subresources within the page, but Safari’s /befloreload/ does exactly that (it fires before loading subresources. To quote the Safari documentation:<br class=""><br class="">   The |"beforeload"| event is generated before loading every script,<br class="">   iframe, image, or style sheet specified in the webpage, for example.<br class=""><br class="">AdBlock Plus for Safari uses the /beforeload/ event (see <a href="https://hg.adblockplus.org/adblockpluschrome/file/67e68cc8e32b/safari/ext/content.js#l58" class="">https://hg.adblockplus.org/adblockpluschrome/file/67e68cc8e32b/safari/ext/content.js#l58</a> for the general idea).<br class=""><br class="">I don’t already know of other Safari extensions that rewrite URLs in /beforeNavigate/, but here’s Apple’s documentation: <a href="https://developer.apple.com/library/safari/documentation/Tools/Conceptual/SafariExtensionGuide/WorkingwithWindowsandTabs/WorkingwithWindowsandTabs.html" class="">https://developer.apple.com/library/safari/documentation/Tools/Conceptual/SafariExtensionGuide/WorkingwithWindowsandTabs/WorkingwithWindowsandTabs.html</a><br class=""><br class="">Well, the link above includes a bunch of stuff, but does talk about /beforeNavigate/.<br class=""><br class="">Let me know and I can start writing the Safari extension (and will try to conform as much as possible to the source of the already-existent extensions).<br class=""><br class="">- Chris.<br class=""><br class=""><blockquote type="cite" class="">On Nov 11, 2014, at 6:36 PM, Jacob S Hoffman-Andrews <<a href="mailto:jsha@eff.org" class="">jsha@eff.org</a><span class="Apple-converted-space"> </span><<a href="mailto:jsha@eff.org" class="">mailto:jsha@eff.org</a>>> wrote:<br class=""><br class="">That does indeed sound like it should work. Is it possible to also rewrite resources within the page that way, or is it only the top-level frame? Could you send a reference to the documentation of beforeNavigate? Are you aware of other Safari extensions that rewrite URLs in beforeNavigate?<br class=""><br class="">This sounds very promising, and assuming it all looks good, it would be awesome for you to write a proof-of-concept Safari version!<br class=""><br class="">On 11/11/2014 05:23 PM, Chris Aljoudi wrote:<br class=""><blockquote type="cite" class="">Hi!<br class=""><br class="">Chris here (JavaScript; UI/UX design). I note you mentioned that the reason HTTPS Everywhere isn’t available for Safari is the inability to do safe rewrites (indeed, window.location, etc. aren’t safe).<br class=""><br class="">I’ve written a few extensions for Safari (I’ve moved to Safari from Chrome), and I believe an extension can rewrite a URL safely by listening to the Safari's /beforeNavigate/ event and changing the URL if necessary (the event is fired before the request is sent).<br class=""><br class="">I think that seems like it'd work. I’d love to help in any way I can if you’re interested (including writing a preliminary version of the Safari extension using the already-existent ones as a guide).<br class=""><br class="">Thanks,<br class="">- Chris.<br class=""><br class="">Chris Aljoudi<br class="">Design. UI/UX. Technology.<br class="">Web:<span class="Apple-converted-space"> </span><a href="https://chrismatic.io/" class="">https://chrismatic.io/</a><br class="">Google Voice: +1 (719) 344-2483<br class=""><br class=""><br class="">_______________________________________________<br class="">HTTPS-Everywhere mailing list<br class=""><a href="mailto:HTTPS-Everywhere@lists.eff.org" class="">HTTPS-Everywhere@lists.eff.org</a><span class="Apple-converted-space"> </span><<a href="mailto:HTTPS-Everywhere@lists.eff.org" class="">mailto:HTTPS-Everywhere@lists.eff.org</a>><br class=""><a href="https://lists.eff.org/mailman/listinfo/https-everywhere" class="">https://lists.eff.org/mailman/listinfo/https-everywhere</a></blockquote></blockquote></blockquote></div></blockquote></div><br class=""></div></div></div></blockquote></div></div></blockquote></div><br class=""></div></div></body></html>