Welcome to the in5 Answer Exchange! This a place to get answers about in5 (InDesign to HTML5) and make requests.
0 votes

Is there a possibility to change the target information? 

<a href="side2/index.html" target="_blank"> what I do need is <a href="side2/index.html" target="_self">

in how_to by (180 points)
  

2 Answers

0 votes
 
Best answer
by (197k points)
0 votes

[Technique is this answer is no longer needed if using v2.6 or higher see this article for more details. ]

Attach the following code as a .js file in the Resources section of the in5 dialog before exporting and it will do the conversion for you:

$(function(){ $('[target]').attr('target', '_self'); });

(Demo file)

by (197k points)
edited by
Thank you – but: I downloaded version 2.3.1 – and then the butten to add a javscript in the export form did not work anymore … is it a bug?
As well we get an error message when we try to check for updates…
Mac osx 10.10.1 / InDesign cs6
The error with the updates should be fixed now (that was an error on our server, not within in5).

The Add JavaScript button is functioning when we test it. Please restart InDesign and give it another try.
Then we got it right – the script is great, but I still had to use a mulifile search to change the target all over the site – is there some "targeting" in some js-scripts as well?
You shouldn't have to replace anything in multiple files. All the files point back to one javascript file. Attaching it as a Resource should be a single-step process.
Hi
Is there a code for change the target only in emails?
I believe the target attribute is ignored for email links, but you can target email links with the following jQuery:
$('[href^=mailto]')

Used in the code above, it would look like:
 $(function(){ $('[href^=mailto]').attr('target', '_self'); });
Thank you very much, it works ok.
Without the Javascript the email links open a new tab browser.