Created
February 24, 2016 08:20
-
-
Save cjthompson/80cce78894edcbc04b8b to your computer and use it in GitHub Desktop.
Lincastor - Two Browsers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* | |
the 'args' dictionary contains following variables: | |
URL => my-http://myhost.domain.com:8080/mysite/a.html?search=blah#myanchor | |
URL_SCHEME => my-http | |
URL_HOST => myhost.domain.com | |
URL_PORT => 8080 | |
URL_PATH => /mysite/a.html | |
URL_QUERY => ?search=blah | |
URL_FRAGMENT => #myanchor | |
URL_VALUE => everything that comes after the 'scheme:' | |
URL_B64VALUE => the same as URL_VALUE but decoded using based64 | |
the url query parameters are parsed in following way: | |
?search=blah&flag=2 would become | |
URL_QUERY_SEARCH => blah | |
URL_QUERY_FLAG => 2 | |
note the upper case of the parameter name | |
if you are mapping a file extension, use URL_PATH to pass the file path | |
--- | |
returning 1 indicates the handler has finished succesfully | |
OR | |
if you intended to trigger this handler from a bookmarket, | |
return valid javascript code as a string to be execute in the browser | |
*) | |
on handle_url(args) | |
set browser to "Vivaldi" | |
if (|URL_HOST| of args contains "mycompany" or |URL_HOST| of args contains "docs.google.com" or |URL_HOST| of args does not contain "." or |URL_HOST| of args contains "slack.com") then | |
set browser to "Google Chrome" | |
end if | |
tell application browser | |
open location |URL| of args | |
activate | |
end tell | |
return 1 | |
end handle_url |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment