Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Is it possible to provide iframe in spModal?

Sathwik1
Tera Expert

In portal, I had a sentence.. when I clicked on it..a popUp needs to open ... in that I want to show some website.. ex: w3 schools website... so what should I need to write?

HTML

<div>
  <p ng-click="c.clck()">Click here to open Popup</p>
</div>

Client controller

api.controller=function(spModal) {
  /* widget controller */
  var c = this;
    
     c.clck= function () {
        spModal.alert('How do you feel today?').then(function (answer) {   // In this line what should I write?
        });
     }
};

 

@Mohith Devatte @Ankur Bawiskar  In PopUp I need to show w3schools website

16 REPLIES 16

Community Alums
Not applicable

Hi,

You can refer to this thread :https://community.servicenow.com/community?id=community_question&sys_id=89bf4610db512c104aa5d9d96896...

Mark my answer correct & Helpful, if Applicable.

Thanks,

Sandeep

Mohith Devatte
Tera Sage
Tera Sage

hey sathwik,

try this 

Create a widget with <iframe> code and copy the ID of the widget

HTML:

HTML

<div>
  <p ng-click="c.click()">Click here to open Popup</p>
</div>

Cope the id of the widget and give it in widget parameter like below 

widget:"your_widget_id"

api.controller=function(spModal) {
  /* widget controller */
  var c = this;
    
     c.click= function () {
     spModal.open({
            title: ''Your Title',
            widget:"your_widget_id_where_iframe_is_present", 
        }).then(function(){
            console.log('widget dismissed');
        })   
     }
};

 

Hope this helps 

Mark the answer correct if this helps you

I tried as per your suggestion @Mohith Devatte  but I'm getting error.. page was not loading.. and also I don't need marked header and bottom in the widget(top and bottom).. how to remove it..

find_real_file.png

can you attach the screen shot once again?

it is broken