Show contact form in a pop-up window with Bootstrap classes
Bootstrap and Ajax are two different methods for modal dialogs.

If you want to open a popup with Bootstrap this would be client side. This means you deliver the form embedded in the page as a block and hide it by wrapping it in a Bootstrap modal container:

https://v4-alpha.getbootstrap.com/components/modal/

If you want to load a modal with Drupal Ajax, then use the link you've provided in the question, but target the url of the form, not that of the frontpage:

&lt;a class="use-ajax" data-dialog-type="modal" href="/contact"&gt;Open form&lt;/a&gt;


For this to work you have to attach a js library:

$build['#attached']['library'][] = 'core/drupal.dialog.ajax';



  And why is the modal window not working for anonyms?


It works for logged in users without attaching the library, because core code is doing this already for the admin dialogs.