boten Active Member Licensed User Longtime User Nov 14, 2011 #1 I'm trying to display several HTML files which are in the Files folder of the project. the code copies the file from DirAssets to DirInternal with a fixed name and then displays the file. Code: Copy If File.Exists(File.DirInternal,"aa.htm") Then File.Delete(File.DirInternal,"aa.htm") File.Copy(File.DirAssets,"file[i]n[/i].htm",File.DirInternal,"aa.htm") s="file:///" & File.DirInternal & "/aa.htm" wv.LoadUrl(s) The problem is that when the 1st file is scrolled down and then the 2nd file is loaded, it is loaded with the "scroll position" of the previous file, that is NOT from the beginning of the 2nd file. Any idea on how to solve that?
I'm trying to display several HTML files which are in the Files folder of the project. the code copies the file from DirAssets to DirInternal with a fixed name and then displays the file. Code: Copy If File.Exists(File.DirInternal,"aa.htm") Then File.Delete(File.DirInternal,"aa.htm") File.Copy(File.DirAssets,"file[i]n[/i].htm",File.DirInternal,"aa.htm") s="file:///" & File.DirInternal & "/aa.htm" wv.LoadUrl(s) The problem is that when the 1st file is scrolled down and then the 2nd file is loaded, it is loaded with the "scroll position" of the previous file, that is NOT from the beginning of the 2nd file. Any idea on how to solve that?
warwound Expert Licensed User Longtime User Nov 14, 2011 #2 Hi. You could try adding a dummy parameter to the URL, something like: Code: Copy Dim param As Long param=DateTime.Now s="file:///" & File.DirInternal & "/aa.htm?param="¶m wv.LoadUrl(s) Tradionally a page with parameters in it's URL will not be cached by the browser - the same might apply to remembering it's scroll position. Martin. Upvote 0
Hi. You could try adding a dummy parameter to the URL, something like: Code: Copy Dim param As Long param=DateTime.Now s="file:///" & File.DirInternal & "/aa.htm?param="¶m wv.LoadUrl(s) Tradionally a page with parameters in it's URL will not be cached by the browser - the same might apply to remembering it's scroll position. Martin.
boten Active Member Licensed User Longtime User Nov 14, 2011 #3 Nope. Didn't help. I even tried the "no-cache" tag without any results. I tried your WebViewExtras.pageUp(wv,True) and it DID scrolled to the top of the page, but it was "slow" (relatively speaking) Upvote 0
Nope. Didn't help. I even tried the "no-cache" tag without any results. I tried your WebViewExtras.pageUp(wv,True) and it DID scrolled to the top of the page, but it was "slow" (relatively speaking)
warwound Expert Licensed User Longtime User Nov 14, 2011 #4 Hi. I think you'll have to save each webpage with a unique filename then. Is that a problem..? Martin. Upvote 0
Hi. I think you'll have to save each webpage with a unique filename then. Is that a problem..? Martin.
nfordbscndrd Well-Known Member Licensed User Longtime User Nov 14, 2011 #5 You could put an anchor at the top of each web page's Body and call the page using the anchor. Example: s="file:///" & File.DirInternal & "/aa.htm#TopOfPage" Upvote 0
You could put an anchor at the top of each web page's Body and call the page using the anchor. Example: s="file:///" & File.DirInternal & "/aa.htm#TopOfPage"
boten Active Member Licensed User Longtime User Nov 14, 2011 #6 warwound said: ...... Is that a problem..? Martin. Click to expand... too many files to fill up DirInternal Thx nfordbscndrd: anchor at top of page did it. Case Closed Upvote 0
warwound said: ...... Is that a problem..? Martin. Click to expand... too many files to fill up DirInternal Thx nfordbscndrd: anchor at top of page did it. Case Closed
warwound Expert Licensed User Longtime User Nov 14, 2011 #7 boten said: Case Closed Click to expand... But why do you need to copy the webpages from DirAssets to DirInternal before loading them in a WebView? If you're worried that the WebView will cache a copy of each page it loads - which it likely will do - then simply clear the WebView cache each time your activity closes. Anyway - glad that nfordbscndrd's anchor suggestion does the trick :sign0060:. Martin. Upvote 0
boten said: Case Closed Click to expand... But why do you need to copy the webpages from DirAssets to DirInternal before loading them in a WebView? If you're worried that the WebView will cache a copy of each page it loads - which it likely will do - then simply clear the WebView cache each time your activity closes. Anyway - glad that nfordbscndrd's anchor suggestion does the trick :sign0060:. Martin.
boten Active Member Licensed User Longtime User Nov 15, 2011 #8 warwound said: But why do you need to copy the webpages from DirAssets to DirInternal before loading them in a WebView? Martin. Click to expand... DirAssets contains HTML files in several sub-dirs, in addition to TTF font files and CSS files. I had "bad" experience loading files from DirAsstets/somesubfolder/A123.htm and referencing CSS & TTF files in other subdirs.... found it "easier" to copy TTF, CSS to DirInternal on Create and then copy the needed HTML on the fly. Upvote 0
warwound said: But why do you need to copy the webpages from DirAssets to DirInternal before loading them in a WebView? Martin. Click to expand... DirAssets contains HTML files in several sub-dirs, in addition to TTF font files and CSS files. I had "bad" experience loading files from DirAsstets/somesubfolder/A123.htm and referencing CSS & TTF files in other subdirs.... found it "easier" to copy TTF, CSS to DirInternal on Create and then copy the needed HTML on the fly.