NAME
Mac::Safari::JavaScript - Run JavaScript in Safari on Mac OS X
SYNOPSIS
use Mac::Safarai::JavaScript qw(safari_js);
// do an alert
safari_js 'alert("Hello Safari User")';
// return some value
var $arrayref = safari_js 'return [1,2,3]';
// multiple lines are okay
safari_js <<'JAVASCRIPT';
var fred = "bob";
return fred;
JAVASCRIPT
DESCRIPTION
This module allows you to execute JavaScript code in the Safari web browser on Mac OS X.
The current implementation wraps the JavaScript in Applescript, compiles it, and executes it in order to control Safari.
FUNCTION
- safari_js($javascript)
-
Runs the JavaScript in the first tab of the front window of the currently running Safari.
Your code is automatically executed in a JavaScript function to avoid namespace polution.
If you JavaScript returns something (via the
return
keyword) then, as long as it can be represented by JSON, it will be returned as the result the function call.
AUTHOR
Written by Mark Fowler <mark@twoshortplanks.com>
Copryright Mark Fowler 2011. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
BUGS
Bugs should be reported to me via the CPAN RT system. http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Mac::Safari::JavaScript