web browser display size

Encountering a challenge here. My approach involves:

Loading 3 html pages consecutively inside webview on android and then trying to obtain the height of each page.

  webview.addJavascriptInterface(new JavaScriptInterface(), "HTMLOUT");

            //webview.setWebViewClient(new WebPLZZClient());
            //webview.setWebViewClient(new WebClient());    
            ViewGroup.LayoutParams bq1=webview.getLayoutParams();
            bq1.height=LayoutParams.WRAP_CONTENT;
            webview.setLayoutParams(bq1);

            webview.loadDataWithBaseURL("file:///android_asset/KH_Brown_Fixed_Layout/",temp1,  "text/html", "utf-8",null);      
            webview.loadUrl("javascript:window.HTMLOUT.getContentHeight(document.getElementsByTagName('html')[0].scrollHeight);");

However, I am unable to retrieve the content height of each page, even just for the first two pages.

Answer №1

Dealing with a comparable issue, I was able to solve it by resetting the view and re-measuring using a smaller size before reloading the view.

For example:

webView.resetView();
webView.remeasure(10, 10);

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

It appears that the .fadeOut() function is not working properly when applied to an image

I want my input text box to automatically submit the form and display a checkmark image after the user has been idle from typing. I tried implementing a fadeout function for the image but it doesn't seem to be working. var timer = null; $('.form ...

Exploring Vue.js: Leveraging External JavaScript/JQuery Functions

I am currently working on developing a lightbox/modal feature using Vue.js. After making significant progress, I have encountered the need to utilize existing functions from another Javascript/Jquery file. Due to the complexity of these functions, rewritin ...

Is there a way to make ListView refresh itself automatically?

My application allows me to display received and sent SMS messages in a ListView. Below is the code snippet: public class ChatActivity extends ListActivity { private MyListAdapter adapter; ArrayList<String> item_id = new ArrayList<String>(); ...

Tips for keeping the options menu visible even when the video is paused

As I was creating my own customized Video player, I encountered an issue where I wanted the options bar/menu to disappear when the user became inactive. While I have managed to achieve this functionality, I still require the option bar to remain visible ...

When my route in NextJS processes the request, it returns a ReadableStream from req

I am encountering an issue with my code and I have tried looking for solutions in other similar questions without any success. Is there anyone who can assist me? Here is the content of my route.js file: import dbConnect from "@/lib/dbConnect"; i ...

The function fails to trigger the ajax request upon clicking the button

Below is a button that I need to work with: <a class="action submit btn btn-danger btn-lg pull-right" onclick="return finishExam();"><i class="glyphicon glyphicon-stop"></i> Finish Exam</a> Here's the JavaScript function asso ...

What steps can be taken to deter users from repeatedly liking comments, similar to the systems seen on Facebook or YouTube for like/dislike features?

I am currently working with express, react, and MySQL. My goal is to implement a like/dislike system for comments. After doing some research, I found that many suggest disabling the like button after a single click. However, I want users to be able to se ...

Having Trouble Connecting Mongoose to MongoDB Version 4.2

My current approach to connecting with Mongoose is not working as expected. I can successfully connect to my database using the shell: mongo --username 'admin' --password 'mypassword' --authenticationDatabase 'admin' The out ...

Prevent the clustering of advertisements using jQuery

Check out my code in action here! jQuery(document).ready(function(){ var insertionTemplate = jQuery(".hiddenAdBox").eq(0).html(), insertionTarget = jQuery('ul'), insertionTargetChildren = insertionTarget.find('li'), ...

Utilizing the Google Maps JavaScript API in npm to generate route directions

After not working with Javascript for a couple of years, I decided to try loading the Google Maps Javascript API npm package in order to display a map and draw directions between two points (Lille and Biarritz, passing through Paris and Bordeaux). Unfortun ...

Ways to extract values from a javascript hash map by exclusively incorporating an array

So here's the issue I'm encountering. Let's consider the following scenario: let surfaces: Map<any, any> = new Map([{"83.1" => Object}, {"84.1" => Object}]) let arr1 = ["83.1"] This is the desired o ...

tips for transferring API JSON response parameters to material ui table

I'm currently working on creating a table with the material UI. My goal is to populate the rows of the table based on the data received from an API response. The challenge I'm facing is that the API response includes an array of objects with mult ...

Adjusting the position of the arrow helper to create more space from the

I am currently working on achieving a specific goal. https://i.sstatic.net/XnAmo.png Instead of moving farther away from the object, the two arrow helpers seem to be shifted inward. How can I adjust their positioning to move them away from the object? B ...

Ways to specifically locate the initial list items

Need help creating an array of the first li elements but unsure of how to proceed. Here is the HTML structure: <div class="nav"> <ul> <li>Element 1</li> <li>Element 2 <ul> <li>Element ...

Troubleshooting webpack encore issues with importing enums from node_modules

I am faced with a challenge of utilizing an enum from a library I created in a different project. The library is developed using Vue and typescript, bundled with rollup. On the other hand, the project is built with Symfony, with the front end also using Vu ...

What is the best way to loop through an array of strings and make them all plural?

I am currently working on a challenge where the objective is to take an array and pluralize each element by adding an 's' at the end of it. Here's my attempt so far, but I suspect that there might be mistakes in my code: var pets = [' ...

Struggling to successfully pass my variable from jQuery (or javascript) to the following page

I'm currently editing a PHP script to pass variables to the next PHP page using a jQuery (or javascript) script instead of a form with the POST method. After reviewing the entire jQuery (or javascript) script and understanding how the author passes hi ...

Sending data from Javascript to PHP using Ajax in Wordpress

Is there a way to pass a JavaScript Object to PHP using Ajax in a Wordpress environment? Currently, the code snippet below is only returning 0 instead of the object. What adjustments should be made to successfully use the amount value in the PHP script? ...

Can we achieve live map updates in real time using Google API with Node.js technology?

Can Google Maps API in conjunction with Node.js provide truly real-time updates on a map without any callback limits, or does Google enforce restrictions such as a 5 second or 30 second time frame? Node.js is known for its ability to handle almost real-ti ...

Angular.js fails to load successfully every other time

My angular application is running into some issues with bower. At times, when I start up the server, I encounter the following error: Uncaught Error: [$injector:modulerr] Failed to instantiate module myApp due to: Error: [$injector:modulerr] Failed to in ...