Topic: 1.5.1 - Possible to make e-mail button open in a new window?

Hi!

Just bought the pro version, and set up my gallery (which you can find here [click on portfolio]: https://lmih.be/ ).
Unfortunately while it's in the iFrame, the e-mail button does not work. If I open the porfolio's direct link ( https://lmih.be/portfolio/ ), it works just fine.

I suspect if the button were to open in a new window/tab I would be able to use it just fine. Is there anything I can modify to do that? =) I didn't see anything in the software so I expect it'd be some code to modify, if it's at all possible to easily modify.

Thank you!

Re: 1.5.1 - Possible to make e-mail button open in a new window?

The Email Button is a 'mailto' link which opens the user's default email client.
If the user has an email program installed (such as Outlook or Thunderbird), then this program will be opened (in its own window) whether the gallery is in an iframe or not.
However, I suspect that your default email client may be a web service (such as Gmail) and that this might be the root of your problem.

I have an email program installed and it opens fine when using the Email Button from both of your links.
If I then change my browser's 'mailto' action to 'Use Googlemail', then the Email Button still works fine from both of your links (but the email page replaces the gallery page in both instances).

Unfortunately while it's in the iFrame, the e-mail button does not work.

What browser do you see the problem in and what is your default email client?
Also, what exactly do you mean when you say that it does not work? Does nothing happen at all when you click the Email Button or does it just not work as expected? (It works fine on my own system with an email program installed.)

Is there anything I can modify to do that?

The code which sets the click handler for the Email Button is buried deep within the 'juicebox'js' JavaScript file which is obfuscated and cannot be modified.
The only thing you could do is override Juicebox's own handling of the Email Button and introduce your own functionality instead.
You could try something like this:

<!--START JUICEBOX EMBED-->
<script src="jbcore/juicebox.js"></script>
<script>
    var jb = new juicebox({
        buttonBarPosition: "TOP",
        containerId: "juicebox-container",
        emailAddress: "email@address.com",
        emailSubject: "Gallery",
        showEmailButton: "TRUE"
    });
    jb.onInitComplete = function() {
        $('.jb-bb-btn-email').off('click');
        $('.jb-bb-btn-email').click(function() {
            var img = jb.getImageIndex();
            window.open('mailto:email@address.com?subject=Gallery&body=Image No. ' + img);
        });
    };
</script>
<div id="juicebox-container"></div>
<!--END JUICEBOX EMBED-->

The code above will likely open a new tab (even if the user's email client is a program) so it might need some further work but I hope it points you in the right direction and helps to get you started.

3 (edited by lmih 2018-02-13 12:22:47)

Re: 1.5.1 - Possible to make e-mail button open in a new window?

Thanks for your reply!

I use browser Gmail. If I use the direct link to the gallery it works, but in the main site nothing happens for me when I click on the e-mail button. I suspected it was related to the browser e-mail which is why I suspected that opening in a new tab would be a workaround since it'd be leaving the iFrame.

And I'm on Chrome, latest version, on Win10.

Edit: But hey if it works for others I can just leave it as is, I won't be sending myself e-mails very often...

Re: 1.5.1 - Possible to make e-mail button open in a new window?

It seems strange that nothing happens when you click the Email Button in your iframe gallery in Chrome.
In Firefox (with 'mailto' set to 'Use Googlemail'), the 'compose new email' content is loaded into the gallery's tab.

I have contacted the developers to suggest that, for a web service email client, the Email Button should perhaps load the 'compose new email' content in a new tab (rather than the gallery's tab) but, even if this is implemented in a future version, there may still be a problem from within an iframe.
There are actually other drawbacks when using iframes (noted here, scroll down to "2) Using an iframe") such as the Expand Button and Shopping Cart Button being disabled (due to limited functionality within an iframe).

Maybe you could find an alternative pop-up dialog that you could load your gallery into that does not use an iframe.
This might be a possible workaround (and you should have more functionality within your gallery).