Home > front end >  HTML href >link text</a> is different from browser "tab title"
HTML href >link text</a> is different from browser "tab title"

Time:03-26

I have the following code

<div >
<p>
<a href="./Arbeitszeugnisse.pdf">Arbeitszeugnisse.pdf</a>
</p>
</div>

where content looks like this

<head>
<style type="text/css">
  .content {
    width: 35%;
    float: left;
    padding: 0px;
    border: 0px solid #8511ae;
    margin-top: 0%;
    margin-bottom: 0%;
    margin-left: 2%;
    margin-right: 3%;
    background-color: #faf9d8;
}
</style>
</head>

When clicking on the link, the tab title used to be Arbeitszeugnisse.pdf. After adding a page to the Arbeitszeugnisse.pdf with PDF Arranger 1.4.2 under Ubuntu 20.04.4 and replacing existing file with the new one, the tab title now prints

Layout 1 - Arbeitszeugnisse.pdf

Similarly I have

<a href="./Bildungsweg.pdf">Bildungsweg.pdf</a>

Bildungsweg.pdf is made up also of multiple files that were concatenated with PDF Arranger. When clicking on Bildungsweg.pdf, the tab title prints

G0-034-F1-20190701130851 - Bildungsweg.pdf

Is there a way to get clean tab titles with no extra text?

CodePudding user response:

You can use the command line exiftool after every PDF edition. For example:

exiftool -Title="" Bildungsweg.pdf

Leave the flag -Title="" empty, without a string. That way, the web browsers will display the filename instead of the metadata incrusted into the PDF.

Take a look at this Gist about anonymising PDFs.

CodePudding user response:

You could achieve the desired result by setting window.status but if it’s an external file I’d have a look at the meta properties of the file generated.

My understanding of the way files are prepared by the PDF parser is that this can be problematic but I think this is where you should begin your bug hunt.

In case you embed the file here is the JavaScript:

<script type=“text/javascript”>
window.status = ‘hello, world’;
</script>
  • Related