Tiny Browser

Instructions

To use Tiny Browser do one of the following:

  1. Drag and drop an HTML file on it
  2. In a shell script or in the Terminal:
    1. open a file, which, if it is not a PDF, it will regard it as HTML
      open -a "Tiny Browser" filepath
      where filepath is the full path to your file (uses double quotes for paths with spaces, e.g., "An Example.html" or "An Example.pdf").
    2. send HTML
      open -a "Tiny Browser" --args "<h1>Hello</h1>"
    3. or in a pipe
      echo "<h1>Hello</h1>" | xargs open -a "Tiny Browser" --args
    4. open it in the background using -g:
      open -g -a "Tiny Browser" --args "<h1>Hello</h1>"
    5. open a web site
      open -a "Tiny Browser" --args 'http://www2.hawaii.edu/~ramonf/TeXShop/index.html'
      (do not forget "--args"!)
    6. open another kind of URL scheme
      open -a "Tiny Browser" --args '<meta http-equiv="refresh" content="0; url=file://localhost/Users/ramon/Tiny Browser/GPL 3.0.pdf">'
      (if you are going to use a protocol often, you can add it to the code, by mimicking what was done for http://)
  3. In the Applescript Editor:
    do shell script "open -a \"Tiny Browser\" \"Example.html\""
    
    where "Example.html" is the full path to the HTML file you want to display, and double quotes have to escaped with a backslash.

Note: unlike other applications created with Platypus, the MainMenu.nib inside the application bundle is editable.

Building Tiny Browser

You may want to build a copy of Tiny Browser of your own, so below are the settings you have to use in Platypus 4.0 (not 4.2 has a significant bug so skip that version, until 4.3 comes out). Note that if you want to run multiple copies of Tiny Browser you need to build the copies, as duplicating the application in the Finder will not be enough, since the window name is hard coded at build time and Tiny Browser uses its name when positioning, resizing, scrolling and fake floating it. You however do not need to modify the script (e.g., your duplicate copy will automatically have its own preference files). Replace the MainMenu.nib with the supplied one, which you can modify using Interface Builder (part of Apple's Developer tools).

Preferences

If you have in System Preferences checked Enable Access for Assistive Devices in the Universal Access preference pane, then you can set the initial position and dimensions of Tiny Browser’s window and whether or not it scrolls to the bottom of the page when it is done rendering.

To do so in the Terminal do the following:

  1. Position:
    1. Whether you want to change the position (YES or NO)
      defaults write org.ramon.TinyBrowser position -boolean YES
    2. Left (x)
      defaults write org.ramon.TinyBrowser x -integer 0
    3. Top (y)
      defaults write org.ramon.TinyBrowser y -integer 0
  2. Dimensions:
    1. Whether you want to change the dimensions (YES or NO)
      defaults write org.ramon.TinyBrowser dimensions -boolean YES
    2. Width
      defaults write org.ramon.TinyBrowser width -integer 600
    3. Height
      defaults write org.ramon.TinyBrowser height -integer 600
  3. Scroll to the bottom (YES or NO):
    defaults write org.ramon.TinyBrowser scroll -boolean YES
  4. Fake floater mode, which means that every half a second Tiny Browser checks to see if its window is the top one, if not it makes it so (YES or NO):
    defaults write org.ramon.TinyBrowser float -boolean YES
    (this setting is NO by default)
If you write a program that does its own manipulation of Tiny Browser’s position, dimensions or scrolling then have it backup the preference file at the beginning, save the values of all the boolean parameters, set them all to NO, and then at the end set them back to their original values (if there is a crash or a bug that impedes your program from finishing its execution, then you have the backup to restore the preferences).

History

License

Copyright (C) 2010 Ramón M. Figueroa-Centeno (ramonf@hawaii.edu).

Tiny Browser is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Tiny Browser is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Tiny Browser. If not, see <http://www.gnu.org/licenses/>.