0

I have a website with this structure

<html>
<head></head>
<body>

<script src=".style/js/javascript.js"></script>
<link rel="stylesheet"  href="./style/css/ipars.css" />
</body>
</html>

I want host js and css (with css inline images) locally in android app. So I create a www folder in assect folder and then move style folder in it. and then I change code to this:

<html>
<head></head>
<body>

<script src="file:///android_asset/www/style/js/javascript.js"></script>
<link rel="stylesheet"  href="file:///android_asset/www/style/css/ipars.css" />
</body>
</html>

Now I browse my website with webview But js and css do not work!

this is my java code in android-studio:

public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View v =inflater.inflate(R.layout.tab_1, container, false);


        WebView webView = (WebView) v.findViewById(R.id.webview1);

        // for wepars.com php
        String agentModified = webView.getSettings().getUserAgentString().concat(" MobileApplication(com.wepars.webapp)");
        webView.getSettings().setUserAgentString(agentModified);

        WebSettings webSettings = webView.getSettings();
        webSettings.setJavaScriptEnabled(true);
        webView.setWebViewClient(new WebViewClient());

        webView.loadUrl("http://www.example.com");
        return v;
    }

what is my wrong?

edit/ not dublicate: I checked the link. it is for local html. I want do it for a remote html.

ali rah
  • 51
  • 7
  • possible duplicate of [WebView, add local .CSS file to an HTML page?](http://stackoverflow.com/questions/7585210/webview-add-local-css-file-to-an-html-page) – TDG Jul 11 '15 at 13:49
  • I checked you link. it is for local html. I want do it for a remote html. – ali rah Jul 11 '15 at 13:53

0 Answers0