1 Reply Latest reply on Nov 11, 2019 9:27 AM by Duncan Mills-Oracle

    open url in the oj-dialog

    Wrushasen Dakhane

      I have a link which returns html content and want to display that inside oj-dialog

       

      Below html feature works:-

       

      window.open(http://localhost:7001/MyApp/MyServlet?user=username);

       

      Below code is not working:-

       

       

      <oj-dialog style="display:none" id="myDialog" dialog-title="My Title" >
          <div slot="body">
              <div  id='myContent' style="display:none">
              </div>
          </div>    
      </oj-dialog>
      

       

      If there is any other component we need to use.

        • 1. Re: open url in the oj-dialog
          Duncan Mills-Oracle

          Doing it that way the HTML fragment that your servlet generates would have to effectivley have to load a complete JET page - e.g. one that loads the JET CSS, RequireJS and an main that loads all the resources.

          Instead why don't you either:

          1. Just open a JET dialog and inside of that have an iframe with a src set to the HTML output of the servlet

          2. Call the servlet, grab the HTML as a view and use that with ojmodule inside of the dialog

          3) Call the servlet, gran the HTML and then set the innerHTML of a div in the dialog

           

          I'd only do 2 or 3 if I was sure about the origin / cleanliness of the HTML as there is a potential security issue if you are just echo-ing HTML that might have been manipulated by a bad actor.