Show a website inside an ionic tab

前端 未结 2 1514
醉梦人生
醉梦人生 2020-12-11 01:35

I am working on an ionic framework based mobile application (mainly targeted for Android). My project is a tab based application. In the first tab I want to load an external

2条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-11 01:49

    Try to load the content from the website via ajax, not the whole page via iframe. You can achieve this by doing it like it follows:

    You're first going to put a div to that place, where you want to page to be displayed.

    HTML:

    And in JavaScript you fetch the code via Ajax or jQuery and after you got it, you're going to fill the div with that code:

    JS:

    /*jQuery*/
    $('#loadExternalURL').load('http://www.google.com');
    
    /*ajax*/
    $.ajax({
      dataType:'html',
      url:'http://www.google.com',
      success:function(data) {
        $('#ajax').html($(data).children());   
      }
    });
    

提交回复
热议问题