0

I would like to have a button when clicked opens up a modal form hosted on another server.

Say the button is on www.web.com/review

Then when you click a button, it opens the modal box on another server and domain www.example.com/modal.

I would like to have a button as below on server A on URL www.web.com/review;

<button type="button" class="btn btn-primary btn-lg btn-flat" data-toggle="modal" data-target="#review-box"> Write a review</button>

When clicked opens up the modal on another server B on URL www.example.com/modal.

<!-- Modal -->
<div class="modal fade" id="review-box" role="dialog">
    <div class="modal-dialog">

        <!-- Modal content-->
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title">Modal Header</h4>
            </div>
            <div class="modal-body">
                <p>Some text in the modal.</p>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            </div>
        </div>

    </div>
</div>

Can this be done or is it far fetched?

Wasif Ali
  • 886
  • 1
  • 13
  • 29
User101
  • 115
  • 1
  • 4
  • 11
  • It a bit hard to understand what would you case scenario that you would like to do that. If you want to redirect to the website B when you click the button, you can redirect that page (with a query https://stackoverflow.com/questions/979975/how-to-get-the-value-from-the-get-parameters) in javascript on click, and based on that the website B can look at its link queries and open the modal. – Constantin Chirila Feb 07 '19 at 12:10
  • @ConstantinChirila I do not want to redirect the user. I just want to open the modal on that page – User101 Feb 07 '19 at 12:13
  • Hmm, you might want to look into WebSockets. Because you seem to try to sync to different websites. – Constantin Chirila Feb 07 '19 at 12:16

1 Answers1

0

From internal server you need to put script frm the button that point to the external link, if you want to hide the external address you can use iframe or point to the modal directly.

    function ExternalLink() {

    let url = 'https://www.externallink.com/;
    window.open(url,"theFrame");
    }

html

    <container>
    <button onClick=ExternalLink()></button>
    <iframe class="embed-responsive-item" name="theFrame" src="#">
    <div class="modal fade" id="myModal" role="dialog">
    </iframe>
    </container>
Sibongile
  • 1
  • 2