This is the talk page for discussing improvements to the LinkPreview page.

Prevent LinkPreview from showing on tabview?

I've started using this javascript and it works pretty well, however I was wondering if it was possible to prevent the link preview from showing when hovering over a tab on tabview? Or is that simply not possible due to the nature of the code?

RoIento (talk) 23:46, February 3, 2018 (UTC)

currently, it is impossible. soon i'll add classes to ignore. Fngplg (talk) 00:37, February 4, 2018 (UTC)
Ah ok, gotcha. Thanks for your hard work!

RoIento (talk) 07:23, February 4, 2018 (UTC)

Show the same image always

Hello, I installed the script in my global scripts page, and I have a problem, all the links that pass the cursor, always show the same image, example here GOTILON - Muro - Contribuciones 17:49, April 6, 2018 (UTC)

it means no image found in the section 0 of target article. if ur wiki doesn't use 0 section (starting articles with ==header==), then u porbably will never get images. Fngplg (talk) 18:39, April 6, 2018 (UTC)
Ah ok, then, is that a default photo when the image is not found in section 0? GOTILON - Muro - Contribuciones 19:26, April 6, 2018 (UTC)
yes, it is Fngplg (talk) 19:40, April 6, 2018 (UTC)
Ok, thanks GOTILON - Talk - Contributions 20:10, April 6, 2018 (UTC)

Change position of image based on width/height?

Hi Fngplg, I was wondering if it's possible to change the position of the preview image and preview text based on the size of the image?

At the moment, the preview image always appears on top, whereas on Wikipedia, if the preview image is larger in width than it is height, the text will appear underneath the image. If the preview image is larger in height than it is width, the preview image will appear to the right of the text.


One last thing, is it possible to do a fade in effect for the link preview, and a fade out effect for when it disappears.

Thank you. RoIento (talk) 10:53, April 21, 2018 (UTC)

this behavior leads to wider previews, when styling based on fixed width. i doubt someone need this. however, u can use this code (change 100 to bigger value, if image will not react):
mw.hook('').add(function(pp) {
  var $pp = $(pp), $div = $pp.find('div'), $img = $pp.find('img');
  setTimeout(function() {
    if(($div.width()/2) > $img.width()) {
  }, 100)

this code will place small image (less than halved preview width) to right.

animation: u can animate preview via css. change opacity from 0 to 1 at 1s:
@keyframes npage-preview {
  from {opacity: 0}
  to {opacity: 1}
.npage-preview {animation: npage-preview 1s}
Fngplg (talk) 14:04, April 21, 2018 (UTC)
Both solutions work perfectly, thank you very much! I'm just testing the look and design of the LinkPreview at the moment. Thanks again :) RoIento (talk) 14:51, April 21, 2018 (UTC)

MediaWiki's version is much better

Is there any way I can import 's version (Extension:Popups) into my wiki, ? I would like to use MediaWiki 's version, rather than Dev's. Is there any way to do this, and if you know, then can you please do so? Thank you if you can. Joey P. (Talk) 23:27, May 25, 2018 (UTC)

u can use special:contact to request it Fngplg (talk) 23:44, May 25, 2018 (UTC)

A different default "noimage"?

In the current version, the "noimage" default image says "no image" in Russian and is in the Borderlands style. And although the latter is somewhat acceptable, I can imagine that every non-Russian wiki (or wiki, where Russian isn't a widely known language) will want to change that image, which makes the installation process unnecessarily more complicated than it needs to be when the user is okay with all other default settings. Perhaps it might be a good idea to find something more international. Ideally, it should be something without any words and only an appropriate icon would tell people that the image is missing. Or perhaps no image should be displayed at all, just the textbox. Using something with English words could also be an alternative which would not remove the problem completely, but could at least reduce its range. Vengir (talkcontributions) 17:44, August 13, 2018 (UTC)

u can use noimage param to change the image Fngplg (talk) 17:52, August 13, 2018 (UTC)
Of course you can. And I did. I'm just suggesting changing the default for users that might want to adopt it in the future. Vengir (talkcontributions) 18:21, August 13, 2018 (UTC)
i'm not a designer nor an artist, and i can't create picture, so i do use what i have. if u have more appropriate free to use picture, i'm open to suggestions Fngplg (talk) 18:25, August 13, 2018 (UTC)
I'm not sure. Maybe something like this? Vengir (talkcontributions) 19:28, August 13, 2018 (UTC)
it will be white image, when default theme is dark. need smth with dark background Fngplg (talk) 20:28, August 13, 2018 (UTC)

Keep text styling

Is it possible to keep text styling (bold, italic, etc.) in the preview? --Frostvalor (talk) 21:03, April 10, 2019 (UTC)

yes. but one will have to maintain blacklisted tags manually. tags are killed for the purpose: it is safest (also, forward-compatible) way to show content of any page. once it will changed, preview will suffer of some vulnerabilites, that can't be healed automatically; mostly, weird-styled tags (like absolutely-positioned elements, that will have unpredictable behavior inside of preview window, or font\bg color that incompatible with font\bg color of preview, or font-size:100500px etc). i can add support for this, but i strongly suggest to reconsider ur wishes and keep preview in one unified style across the wiki. Fngplg (talk) 21:56, April 10, 2019 (UTC)
I see your point. Well, in that case let's keep it as it is. --Frostvalor (talk) 08:49, April 11, 2019 (UTC)

Image auto repositioning

I also have another idea. Is it possible to put image on the right automatically if it has portrait orientation? Like if image's height > width, put it on the right, in other case put it on top?--Frostvalor (talk) 08:51, April 11, 2019 (UTC)

something like this? Fngplg (talk) 11:22, April 11, 2019 (UTC)
Yes, exactly. That code needs to be added to MediaWiki:Common.js? --Frostvalor (talk) 11:53, April 11, 2019 (UTC)
yes, if you want it sitewide. Fngplg (talk) 14:18, April 11, 2019 (UTC)

Suggested modifications

I've been experimenting for a while to improve LinkPreview, and came with this and this (please enable test mode to see it). My version has auto image relocation: if image has portrait orientation, it will be put to the right, and tooltip will be expanded to provide enough space for a text. So, what do you think about adding my code to version located here? --Frostvalor (talk) 14:34, April 11, 2019 (UTC)

Oh, and in case of missing images nothing is shown (like in Wikipedia). As for test page, main page has all cases present. --Frostvalor (talk) 14:39, April 11, 2019 (UTC)
if you talking about adding this to the base script as default behavior, then: no. it's community-specific stuff. some communities might be happy with it, some communities might be pissed off. communities can do it on per-wiki basis, that's enough. Fngplg (talk) 14:44, April 11, 2019 (UTC)
OK, I see. In this case can I create modified version here, on Dev Wiki, under some other name?--Frostvalor (talk) 14:57, April 11, 2019 (UTC)
all content is under cc-by-sa. so you can do anything that doesn't break the licence. although i would not recommend to create such copies on dev wiki, because of dev:p. Fngplg (talk) 15:12, April 11, 2019 (UTC)

Limit preview to articles only

Is where any way to limit preview to articles only (Main) without typing all other namespaces to ipages? --Frostvalor (talk) 14:03, April 12, 2019 (UTC)

why do you need more than one way to do same thing? Fngplg (talk) 17:26, April 12, 2019 (UTC)
Well, I have more than 20 namespaces except Main, so I thought that there is more optimal way to do it. --Frostvalor (talk) 18:00, April 12, 2019 (UTC)
it is thing, that you do for couple of minutes, once for your lifetime. "more optimal" means that you will do same thing for one minute less. it doesn't worth it. actually, time that spent for this conversation is fully covers whole benefits, that you might have. Fngplg (talk) 18:44, April 12, 2019 (UTC)


Hi, is it possible to like disable the link preview for infoboxes? But like it will appear for other links.

{{SUBST:User:Aphrodite Belleza/Sig}} 15:47, June 21, 2019 (UTC)

u can add aside to the iparents array. see documentation for details. Fngplg (talk) 15:53, June 21, 2019 (UTC)


I don't see why some wikis wordmark would be the default image if there is no image on an article. Wolfie 08:55, August 1, 2019 (UTC)

i'd suggest to read this. Fngplg (talk) 09:43, August 1, 2019 (UTC)

How can I remove the preview image?

Good evening!,

I'm trying to use and to modify this code for my wiki but the only problem is, that I'd like to change the preview image when the article doesn't contain an image in the infobox. I hope there's a value or code making possible to remove the russian image. May there be a chance of using an image, which is in a gallery in this article?

I hope you can help me in some way.

Thank you! Don't forget to smile to your loved ones today! ~Aki (talk) 13:33, October 6, 2019 (UTC)

there are defimage, noimage, and css-rules available. read the doc page for further info. Fngplg (talk) 14:24, October 6, 2019 (UTC)
Community content is available under CC-BY-SA unless otherwise noted.

Fandom may earn an affiliate commission on sales made from links on this page.

Stream the best stories.

Fandom may earn an affiliate commission on sales made from links on this page.

Get Disney+