Fixing Browser Shots plugin

Jan 152015
 Posted by on 15/01/2015 How-To's Tagged with: , , ,  Add comments

On 18.01.2015, the plugin was updated to fix the problems. For the new issues introduced in version 1.3 of Browser Shots see this post.

On “What we did?” page I use “Browser Shots” plugin for generating the images of the sites where I contributed in some way. Even if is not so hard to add myself the links to “mshots” site as Binary Moon told in his article about the history of the plugin, is much more convenient to add a shortcode. And all things was fine for years.


But few days ago the plugin was updated in Repository. Reading the changelog I was very eager to update the plugin. The authors promised a lot of useful improvements – possibility to change the url where the webshot link to, possibility  to open the link in a new browser window/tab, support for captions, possibility to change the height of shot.

And yes, they respected their promise. Previously I used BM Shots only to generate the images, but I’ve added myself the links to third party sites. After updating the plugin I was able to change all links in an half of hour , using only the parameters of plugin. Cool!

BUT… I did all these changes in TEXT mode, as the Visual mode was killed completely after updating the plugin. For me wasn’t a problem with the plugin itself, anyway for making the changes I need to work in TEXT mode for removing my old links, but for writing my posts I need the Visual mode. So, I tried to solve the problem. Looking in browser-shots.php I found this code:

 As you can see the plugin looks for browser-shots.min.js file which, guess what, simply is not packed in the plugin. Instead exist only browser-shots.js

BEEEE-YOOOO-TIFUL!!! The problem is solved I thought… I can change the call from php file to the existing js file, or I can make a copy of js file which can be renamed as browser-shot.min.js and all things will start to works…

No, it wasn’t so simple… Yes, after I made the changes the buttons come back in their places… but Browser Shot button don’t does nothing… inserts only a closing bracket “]” on page. Not good… Editing the js file I found this:

Of course, var shortcode = ']';  overwrite all the construction from above, so, we will have only a ‘]’ on the page by using the button.

In short, I changed the code with this:

The code not just solve the problem of the functionality of the button, but also I’ve added support for the new parameters introduced in this new version. Now will be prompted to insert height, link, target, even a caption, so, the shortcode will be completed only by using the button. Can download the files from here: Download Browser Shots Javascript.

The zip archive contain the modified file browser-shots.js and a minified file browser-shots.min.js (I used Notepad++ for removing whitespaces). Unzip and copy the files under /plugins/browser-shots/js folder. You need only the minified file to be there, but I left the large file if someone want to forge it. Hopefully Ben Gillbanks and Kevin Leary will add a patch for the next version of the plugin. URI:  


Experienced web developer and graphic designer. Former consultant for Suffusion theme and former moderator on Suffusion Support forum. I teach others while learning myself.

Google+ Profile

    Google+ Page

 Leave a Reply

(Your comment will be published. To contact me privately, use the contact form.)

This site uses Akismet to reduce spam. Learn how your comment data is processed.