1
$\begingroup$

I occasionally export notebooks as HTML. These notebooks contain many hyperlinks to web locations that were inserted non-programmatically with Insert -> Hyperlink..., then exported to HTML using the File -> Save As... -> Web Page (*.html) menu item. The only thing I'm struggling with is that when a link is clicked, the original window is replaced by a new one, while I would like it to open in a new browser tab. The Advanced option in the Insert -> Hyperlink... dialog works only if the notebook is deployed in the cloud which is not my case.

I'm considering postprocessing (in the WL, of course) to insert target="_blank" in the correct places in the HTML, but before I do that, isn't there a more straightforward way?

$\endgroup$
2
  • 1
    $\begingroup$ I can't think of a straightforward way to do that. If it were me, I'd post-processs with a sed or perl script on the html files. $\endgroup$ Commented Jun 16 at 17:55
  • $\begingroup$ @CraigCarter I agree. Post-processing seems to be the only way to do that. I needed it quickly and that's why I did it that way. But instead of sed or perl I used a piece of WL code hidden in a closed cell directly in the *.nb source. It simply does Import["...html", "Text"] into a single long string, uses StringReplace appropriately, and Exports back to *.html file. It's not very elegant, but it works reliably. $\endgroup$ Commented Jun 16 at 19:24

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.