Jump to content

Talk:Snippets/Open specific links in new window

Add topic
From mediawiki.org
Latest comment: 3 years ago by Ciencia Al Poder in topic where to put this code?

Open a linked image in a new window

[edit]

The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.


When I try to do this with an image:

<span class="newwin">[[File:Summer Banner.jpg|link=Summer Fun]]</span>

It gives me a "Bad title" page with this error: The requested page title contains invalid characters: "[".

and the URL looks like this: https://mywikisite/index.php/[object%20HTMLImageElement]

Any ideas? Jrsovereign (talk) 14:50, 7 July 2017 (UTC)Reply

I've updated the code to fix this. Ciencia Al Poder (talk) 19:51, 10 July 2017 (UTC)Reply
Thanks! Works great. Jrsovereign (talk) 16:10, 12 July 2017 (UTC)Reply
The discussion above is closed. Please do not modify it. No further edits should be made to this discussion.

This does not work in Mediawiki 1.31

[edit]

In Mediawiki 1.31 this does not work. Neither for internal nor for external links. MichaelKuhn (talk) 08:54, 1 August 2021 (UTC)Reply

Works for me if I copy the code and execute it on the browser's JavaScript console, and then click on the link with that markup.
Maybe you put the code on the wrong place, or there are other JavaScript errors preventing this code from being executed. Ciencia Al Poder (talk) 09:13, 3 August 2021 (UTC)Reply

where to put this code?

[edit]

i am not sure where i have to put this code, please help... 80.188.94.196 (talk) 15:17, 24 January 2022 (UTC)Reply

This is JavaScript code. See Manual:Interface/JavaScript Ciencia Al Poder (talk) 15:29, 24 January 2022 (UTC)Reply