Pass A URL w/Javascript [was Re: revGoURL and Windows IE...]

Scott Rossi scott at tactilemedia.com
Tue Aug 12 17:50:01 EDT 2003


Recently, "Mark Brownell"  wrote:

> test this if you know how:
> 
> <a href="#"  
> onclick="window.open('http://
> www.ibm.com','Windowname','menubar,status,scrollbars,resizable,toolbar,l
> ocation,width=600,height=800');"> Click IBM for new window</a>
> 
> That is if you can figure out how to pass all this in a go URL handler.
> I've been all over the cookbook and docs looking for a way to pick up
> the link inside the <a href="http://www.ibm.com">thisLink</a> and pass
> it from a mouse click in a text field.

One way to accomplish the above is to write an HTML file to the drive and
launch the file.  This is a technique I use as a backup for launching a URL
in a non-common browser (such as Earthlink's modified version of IE) and is
roughly equivalent to double-clicking an HTML document on the desktop.  It's
not elegant, but it works.

The following is a combination of scripts I use on Mac and Win platforms.
You could add any HTML/Javascript code to the createHTML function to
accomplish whatever result is desired.

[ in a button script ]

on mouseUp
  put "http://www.runrev.com" into tURL
  put the tempName into tLaunchPath
  set itemDel to "/"
  put "temp_launch.html" into last item of tLaunchPath
  set itemDel to ","
  put createHTML(tURL) into tCode
  #
  if "Mac" is in platform() then
    set the fileType to "????TEXT"
    put tCode into url ("file:" & tLaunchPath)
    delete char 1 of tLaunchPath
    replace "/" with ":" in tLaunchPath
    put "tell application" && quote & "Finder" & quote & cr &\
        "open file" && quote & tLaunchPath & quote & cr &\
        "end tell" into s
    do s as AppleScript
  end if
  #
  if "Win" is in platform() then
    put tCode into url ("file:" & tLaunchPath)
    set the hideConsoleWindows to true
    put empty into tTitle
    if "NT" is in systemVersion() then
      set the shellCommand to "cmd.exe"
      put quote & quote into tTitle
    end if
    get shell("start" && tTitle && quote & tURL & quote)
  end if
end mouseUp


function createHTML tURL
  put \
      "<html>" & return &\
      "<head>" & return &\
      "<meta http-equiv=" & quote & "Refresh" & quote && "content=" &\
      quote & "0; URL=" & tURL & quote & ">" & return &\
      "<title>Launcher</title>" & return &\
      "</head>" & return &\
      "<body>" & return &\
      "<center>" & return &\
      "<BR><BR><BR>" & return &\
      "Loading URL. One moment please..." & return &\
      "</center>" & return &\
      "</body>" & return &\
      "</html>" into tCode
  return tCode
end createHTML


Regards,

Scott Rossi
Creative Director
Tactile Media, Multimedia & Design
-----
E: scott at tactilemedia.com
W: http://www.tactilemedia.com




More information about the use-livecode mailing list