[TxMt] Re: HTML output: Open link in default browser?

Allan Odgaard mailinglist at textmate.org
Sat Mar 1 06:15:08 UTC 2014

On 1 Mar 2014, at 9:20, Stefan Daschek wrote:

> Is it possible to force specific links in the HTML output window to 
> open in the default browser […] I have a Rails project where the 
> testsuite already creates a dump of the HTML page for each failed 
> feature spec. Now I’m trying to extend RSpec’s TextMateFormatter 
> to include links to these files. Works so far, but I need to open the 
> saved HTML pages in my default browser so that I have my usual 
> developer tools around for debugging.

Given that you are modifying the generated output, you can change the 
link to use JavaScript and TextMate.system(), example:

	function open_url(url) {
	  TextMate.system("open '" + url + "'");

	<a href="#" onClick="open_url('http://macromates.com/'); return 
true;">Open Website</a>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20140301/0845b10d/attachment.html>

More information about the textmate mailing list