Problem: The Mac OSX ".webloc" files are not cross-platform. Windows and Linux users can't open them since they are Mac resource files.
CategoryApplescript CategoryInternet
Solution: create an HTML Redirect file from the URL. This Applescript takes a URL from the clipboard and leaves an HTML file on the desktop:
#!Applescript (-)
-- http://Gnarlodious.com/Computer/Applescript/UrlRedirect
-- this Applescript will take a URL on the clipboard and make an HTML redirect page to that URL on the desktop
-- the resulting HTML file will work in Mac or Windows replacing a .webloc or .URL file
set someURL to the clipboard as string
if someURL begins with "http" then
set fileName to do shell script "echo " & quoted form of someURL & " | sed 's|^http://\\([^/]*\\).*$|\\1|' "
"<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01//EN'
<title>Redirect page</title>
<META HTTP-EQUIV='Refresh' CONTENT='0; URL=" & someURL & "'>
<p> <p> <p>
<h1>You are being redirected...</h1>"
do shell script "echo " & quoted form of the result & " > ~/Desktop/" & fileName & ".html"
else
display dialog "Error... put a URL on the clipboard"
end if
To optimize script access see Applescript Menu
991 page views.