Android Question webview mixed resource files

Hamied Abou Hulaikah

Well-Known Member
Licensed User
Longtime User
Hi everyone ...
I have a project relays on webview, it loads a file from url, this file content is like this:
B4X:
<!DOCTYPE html>

<html dir="rtl">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">

  <title>Hi</title>

  <link href="css/ionic.min.css" rel="stylesheet" type="text/css">

  <!-- Core stylesheets -->
  <link href="css/bootstrap.rtl.min.css" rel="stylesheet" type="text/css">
  <link href="css/pixeladmin.rtl.min.css" rel="stylesheet" type="text/css">
  <link href="css/widgets.rtl.min.css" rel="stylesheet" type="text/css">

  <!-- Theme -->
  <link href="css/themes/frost.rtl.min.css" rel="stylesheet" type="text/css">

  <!-- Pace.js -->
  <script src="pace/pace.min.js"></script>
</head>
<body>
  <!-- Nav -->
  <nav class="px-nav px-nav-left">
    <button type="button" class="px-nav-toggle" data-toggle="px-nav">
      <span class="px-nav-toggle-arrow"></span>
      <span class="navbar-toggle-icon"></span>
      <span class="px-nav-toggle-label font-size-11">Hide Menu</span>
    </button>

    <ul class="px-nav-content">
      <li class="px-nav-item">
        <a href="index.html"><i class="px-nav-icon ion-arrow-left-b"></i><span class="px-nav-label">Home</span></a>
      </li>
      <li class="px-nav-item px-nav-dropdown">
        <a href="#"><i class="px-nav-icon fa fa-hand-peace-o ion-arrow-left-b"></i><span class="px-nav-label">Submenu</span></a>

        <ul class="px-nav-dropdown-menu">
          <li class="px-nav-item"><a href="#"><span class="px-nav-label">Link1</span></a></li>
          <li class="px-nav-item"><a href="#"><span class="px-nav-label">Link2</span></a></li>
        </ul>
      </li>
    </ul>
  </nav>

  <!-- Navbar -->
  <nav class="navbar px-navbar">
    <div class="navbar-header">
      <a class="navbar-brand" href="#">Brand Name</a>
    </div>

    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#px-navbar-collapse" aria-expanded="false"><i class="navbar-toggle-icon"></i></button>

    <div class="collapse navbar-collapse" id="px-navbar-collapse">
       <ul class="nav navbar-nav">
        <li><a href="#">Link</a></li>
      </ul>

      <ul class="nav navbar-nav navbar-right">
        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
            <i class="px-nav-icon ion-android-person"></i><span class="px-nav-label">Visitor</span>
          </a>
          <ul class="dropdown-menu">
            <li><a href="#">First item</a></li>
            <li><a href="#">Second item</a></li>
            <li class="divider"></li>
            <li><a href="#">Third item</a></li>
          </ul>
        </li>
      </ul>
    </div>
  </nav>

  <!-- Content -->
  <div class="px-content">
    <div class="page-header">
      <h1><i class="page-header-icon ion-grid"></i>Breadcramb</h1>
    </div>

    <div>Content</div>
   
  </div>

  <!-- Footer -->
  <footer class="px-footer px-footer-bottom">
    Footer Section
  </footer>

  <!-- ==============================================================================
  |
  |  SCRIPTS
  |
  =============================================================================== -->

  <!-- Load jQuery -->
  <script src="js/jquery-3.2.1.min.js"></script>

  <!-- Core scripts -->
  <script src="js/bootstrap.min.js"></script>
  <script src="js/pixeladmin.min.js"></script>

  <!-- Your scripts -->
  <script src="js/app.js"></script>
</body>
</html>
As you can see it has a lot of assets files (js/css/images) that will make the opening of webview heaver and repeated every time on opening webview!!! So I need this approach:
- the html file loaded from webview.loadurl function
- the assets files mentioned in this html file loaded from the local assets directory of the project

Thank you
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

Hamied Abou Hulaikah

Well-Known Member
Licensed User
Longtime User
It is not what i need ...
I want to load the main html file from server using webview.loadurl , then load the assets files tied to it from android assets.
 
Upvote 0
Top