How can I create a button to open new page in new Tab

User734543
Tera Contributor

Hello,

I want to create a button in Service Portal (ESC) on 1 of the widget and when someone click on that button user should be redirected to new page in new tab but in same browser window. Can someone please help me on this requirement.

Thanks

1 ACCEPTED SOLUTION

Community Alums
Not applicable

Hello @User734543 ,

 

For this u need to write this code in HTML of ur widget:

<button ng-click='c.openModal()'> Open Window </button>

 

And this code in "client script" of ur widget:

 

api.controller=function() {
/* widget controller */
var c = this;
c.openModal = function(){
window.open("https://www.servicenow.com/community/"); //add link of ur page
}
}

 

If u want to design ur button then u can add CSS too.

 

@User734543 , Please mark my answer as accepted solution and helpful. If it is works for u.

 

Thank you.

View solution in original post

1 REPLY 1

Community Alums
Not applicable

Hello @User734543 ,

 

For this u need to write this code in HTML of ur widget:

<button ng-click='c.openModal()'> Open Window </button>

 

And this code in "client script" of ur widget:

 

api.controller=function() {
/* widget controller */
var c = this;
c.openModal = function(){
window.open("https://www.servicenow.com/community/"); //add link of ur page
}
}

 

If u want to design ur button then u can add CSS too.

 

@User734543 , Please mark my answer as accepted solution and helpful. If it is works for u.

 

Thank you.