blueswen / mkdocs-swagger-ui-tag

A MkDocs plugin supports adding Swagger UI to the page.
https://blueswen.github.io/mkdocs-swagger-ui-tag/
MIT License
75 stars 7 forks source link

How to download a specification #23

Closed koshelekapi closed 4 months ago

koshelekapi commented 6 months ago

"Hello! Thank you for your plugin. We are using version 0.6.4 installed on Mkdocs Material version 9.2.5. We are using it as follows: links to OpenAPI yaml specifications are embedded in markdown pages. We encountered the following behavior: when clicking on the specification link, its text opens in a new tab. Expected behavior: a modal window should open to save the specification. How can we achieve this behavior? I am attaching a screencast showing the actual and desired behavior."

[Uploading screencast-bpconcjcammlapcogcnnelfmaeghhagj-2024.02.27-12_11_03.webm…]()

blueswen commented 4 months ago

The behavior of the browser when handling link clicking depends on the HTTP response's file content Content-Type and Content-Disposition. If the Content-Disposition header is set to attachment, the browser will download the file. When Content-Disposition is not set, the browser will check the Content-Type and then open the content if it can be displayed, or download the file if it cannot.

Since these response headers are controlled by the server, the behavior you desire requires modifying the server settings. I'm not sure where you host your document; if you are using GitHub Pages, I didn't find any place where you could modify these settings.