logo
down
shadow

How can I scroll content of <webview> tag from JavaScript?


How can I scroll content of <webview> tag from JavaScript?

By : Arjie Sotto
Date : November 19 2020, 01:01 AM
it helps some times atom-shell: https://github.com/atom/atom-shell version: v0.20.2 , Yes, do this instead:
code :
var webView = document.getElementById('webview tag id');
webView.executeJavaScript("document.querySelector('body:first-child').scrollTop=100");


Share : facebook icon twitter icon
UIPageViewController Scroll transition affects webView content loading

UIPageViewController Scroll transition affects webView content loading


By : Mansoor
Date : March 29 2020, 07:55 AM
it fixes the issue I ended up using Solution 3 from here and making the Scrollview fit my views: UIWebView Doesn't Load Completely, Height Varies
code :
CGFloat height = [[aWebView stringByEvaluatingJavaScriptFromString:@"document.height"] floatValue];
CGFloat width = [[aWebView stringByEvaluatingJavaScriptFromString:@"document.width"] floatValue];
CGRect frame = aWebView.frame;
frame.size.height = height + 130.0;
frame.size.width = width;
aWebView.frame = frame;

//Scrollview height for my views
CGRect screenRect = [[UIScreen mainScreen] bounds];
CGFloat screenWidth = screenRect.size.width;
self.scrollView.contentSize=CGSizeMake(screenWidth, self.articleImgView.frame.size.height+self.articleContentWebView.frame.size.height);
WebView scroll content

WebView scroll content


By : newuser
Date : March 29 2020, 07:55 AM
it fixes the issue You're mostly there. You need to save the current position when you leave the page and then navigate back that position when you get back to the page. Try this:
In MainPage.xaml.cs:
code :
    static Point ScrollPosition = new Point();

    private void MyWebView_ScriptNotify(object sender, NotifyEventArgs e)
    {
        string[] Coordinates = e.Value.Split(',');
        ScrollPosition.X = double.Parse(Coordinates[0]);
        ScrollPosition.Y = double.Parse(Coordinates[1]);
    }

    private async void MyWebView_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
    {
        await MyWebView.InvokeScriptAsync("SetScrollPosition", new string[] { ScrollPosition.X.ToString(), ScrollPosition.Y.ToString() });
    }
  <WebView x:Name="MyWebView" Width="800" Height="500" Source="ms-appx-web:///HTMLPage1.html" ScriptNotify="MyWebView_ScriptNotify" NavigationCompleted="MyWebView_NavigationCompleted"/>
  window.onscroll = GetScrollPosition;

    function GetScrollPosition() {
        window.external.notify(window.pageXOffset + "," + window.pageYOffset);
    }

    function SetScrollPosition(X, Y) {
        window.scrollTo(X, Y);
        window.external.notify(window.pageXOffset + "," + window.pageYOffset);
    }
Scroll to HTML content in WebView

Scroll to HTML content in WebView


By : Linux Gete
Date : March 29 2020, 07:55 AM
I wish this helpful for you Maybe not directly with WebView but with javascript. If you have a js function to scroll to an element such as this :
code :
function scrollTo(element){
   document.getElementById(element).scrollIntoView();
}
mWebView.loadUrl("javascript:scrollTo('element')");
mWebView.getSettings().setJavaScriptEnabled(true);
How can I scroll the webview's content by scrollview?

How can I scroll the webview's content by scrollview?


By : user4078331
Date : March 29 2020, 07:55 AM
To fix this issue If you want all your views to get scrolled inside single scroller, there is a very useful library - commonsguy/cwac-merge
There is single condition you need o satisfy to use the code provided below. Remember, this approach towards your problem can be different but end result is exactly what you need.
code :
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#FFFFFF">

<ListView
    android:id="@+id/list"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
</ListView>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">


    <WebView
        android:id="@+id/webView"
        android:layout_width="match_parent"
        android:layout_height="120dp"
        android:layout_alignParentBottom="true"
        android:background="#767676">
    </WebView>

</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">


    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Hello There"
        android:textColor="#FFFFFF">

    </TextView>

</RelativeLayout>
ListView list = (ListView) findViewById(R.id.list);
MergeAdapter mg = new MergeAdapter();

/**
 * Prgram your webview
 */
View web = getLayoutInflater().inflate(R.layout.viewWebView, null);
WebView web = (WebView) web.findViewById(R.id.webView);
//TODO: Code your webview!!

mg.addView(web);
mg.addView(getLayoutInflater().inflate(R.layout.viewTextView, null));
list.setAdapter(mg);
Android WebView shows content only after a click/scroll

Android WebView shows content only after a click/scroll


By : Brian
Date : March 29 2020, 07:55 AM
I hope this helps you . I am writing an Android app cotaining a webview, which loads a page including a rather large form. I show a progress bar during the loading of the form. When the progress bar disappears, I often see only a blank page or some few elements of the form (like few of the checkboxes, no text). After I try to scroll the page (click), everything shows up. Any idea of what's wrong here? , I'm having a different issue but encountered this. Doing
Related Posts Related Posts :
  • es lint '' is assigned a value but never used' eventhough i have used it
  • Can "name" attribute be used for custom VueJS components
  • Get innerHTML of content when it is clicked
  • HTTPS causes CSS animations to not load? Very confused
  • How to hide other div apart from touched div to the band
  • Is global variable assignment atomic on NodeJS?
  • Datepicker onchangemonthyear beforeshowday
  • trying to render html files using jade but it still adresses it as a jade
  • Google Analytics - Understanding and Dissecting the Snippet: What is | | [ ];
  • Replacing "[aA09.b]." to "[aA09.b]\n" in in JavaScript
  • Why wrap a function definition in an immediate function?
  • Enable / disable jQuery script on switching to different tab in a HTML page
  • how can find return variable value outside anonymous function in node js mysql query function
  • Converting 1 to 0001 in javascript array
  • svg viewbox should not resize the text fontSize?
  • store newline character with string in a variable
  • MP4 videos in Flowplayer does not play in Windows 7 Chrome
  • jquery focusin event not firing
  • How to debug Vue application with google chrome
  • html 5 web app cache download complete javascript alert?
  • Ember.js setupController fired only once
  • How to validate a currency input
  • How to convert my Array of data to key & value pair
  • Statistics circles in CSS
  • So I wanted to make a trig solver in javascript?
  • Showing HighCharts series name on x-axis and in legend
  • In Rails, how can we pass parameters in script?
  • Build Fails: `npm rebuild node-sass --force`
  • Angular Datepicker change dateformat
  • Trying to extract data from between two sets of characters
  • Configuring Jest in WebStorm
  • Uncaught Error: Syntax error, unrecognized expression: tr.ec_portfolio_title,
  • JQuery fading in fading out continuously
  • Unexpected end of input (Line 1) and Undefined Function?
  • How to animate the width of a div slowly with jquery
  • JavaScript + RegEx Complications- Searching Strings Not Containing SubString
  • SignalR - Unable to get property 'client' of undefined or null reference
  • full calendar not displaying when loaded (with backbone)
  • Angular: Update service and share data between controllers
  • ReplaceAll Google script
  • Search for matching LI items in separate UL
  • Access arguments of an... argument
  • Customizing Google custom search jsapi (query strings)
  • React | Can´t load Images > Module not found
  • Dynamically creating buttons in DOJO
  • 404 Not Found in AJAX post call
  • How do I find out, using javascript, what software opened and running my application?
  • Javascript to check the status of wireless connection
  • StarDict support for JavaScript and a Firefox OS App
  • Phonegap event Resume
  • call javascript function on ENTER key press?
  • When is the best time to remove no-js classes from the html tag
  • Recommended email sending languages
  • setInterval not working properly with chrome
  • Does IE create new scope for each script tag?
  • Uncaught SyntaxError: Unexpected token < Underscore and parse issues
  • How to pass captured URL to Email Body in HTML
  • How to structure default nested resources?
  • Store all the keys of a JSON object in a variable
  • Need an efficient way to group the Array of object in javascript
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org