Someone Special
Someone Special

Reputation: 13588

Bootstrap Modal open on new page

I have a bootstrap toggle link which will open a full screen modal windows on left click which will display all the information.

<a data-toggle="modal" data-backdrop="static" href='#modal-add-contact' class='btn'>View Info</a>

However, sometimes when user go through the table list on the page with multiple View Info links, they tend to right click and open to new tab, or right click and open to new window.

So it end up displaying the table list of info with the View Info link instead of the modal window.

How can I let the new tab window load the Modal on default base on the link clicked?

Upvotes: 2

Views: 3628

Answers (2)

tmg
tmg

Reputation: 20393

If user right clicks and opens link in tab, he will get same url with a hash tag www.example.com#modal-add-contact

So if you simply

$(document).ready(function() {
    $(window.location.hash).modal("show");
});

modal will be up.

Upvotes: 1

Asim Khan
Asim Khan

Reputation: 572

Have you tried capturing right-clicks that an event fires up named oncontextmenu? explained in this answer You just have to manually open the modal dialogue using code of some JQuery explained in this answer

Upvotes: 0

Related Questions