Open URL in a tab

0
I want to implement a feature in mendix where i have two tabs, if i click on one tab, it needs to open the respective url in the tab itself,.. for example if i click on first tab it need to open google.com in the tab it self and if i click on second tab, it will open medix.com like that. anyone please help me how to do this?  
asked
1 answers
1

Hi Akash Babu Tammali,

                   As per your requirement, you want to display the other sites in your application If a user clicks on the tab container. Right? So my suggestion would be to go for iFrame. Check, are there any iFrame widgets available in our Mendix Appstore or not. or else, I will suggest one way to achieve this by using HTMLSnippet and JavaScript widgets. 

By using the HTMLSnippet widget, you can add the iFrame tag to call other sites from our application.

Use this code inside HTMLSnippet Content area and call your site address in src attribute tag :

 <iframe id="frame"  width="100%" height = "100%" src="https://getbootstrap.com/" frameborder="0" scrolling="auto">
  </iframe>

Add Javascript Snippet widget below the tab container. When you use iFrame, the height will not be set properly. You can use jQuery to add height property to this iFrame outer div container. I will share that jQuery code below.

First, you need to add some class name to the HTML snippet widget apperance section. For example, I have added (test) class name to my HTMLSnippet widget. 

$( ".test div:first-child" ).css( "height", "2000px" );

You can set height as per your need. I hope, it will be helpful for you.

For your reference, I have tried the same in the sample application. It works. I hope, it will work for you! :

Thanks and regards,

Vijayabharathi V

 

answered