Devv Active Member Licensed User Longtime User Jan 15, 2020 #1 Hello i am trying to hide an element before the page load i tried using webview extras to inject JS on page finished it worked, but there is about half of a second the element is visable until JS is executed (the element flicker quickly) how can i hide that element before the page load so it wont appear at all ? B4X: WebViewExtra.ExecuteJavascript("document.getElementsByClassName('customer-signin-module')[0].remove();")
Hello i am trying to hide an element before the page load i tried using webview extras to inject JS on page finished it worked, but there is about half of a second the element is visable until JS is executed (the element flicker quickly) how can i hide that element before the page load so it wont appear at all ? B4X: WebViewExtra.ExecuteJavascript("document.getElementsByClassName('customer-signin-module')[0].remove();")
S sorex Expert Licensed User Longtime User Jan 15, 2020 #2 is the data coming from something you host yourself? Upvote 0
Devv Active Member Licensed User Longtime User Jan 15, 2020 #3 sorex said: is the data coming from something you host yourself? Click to expand... yes but i have small to no control over the content 1- i don't want to hide these elements for browser visitors (need to hide them only in my app webview) 2- i am using an eCommerce platform with caching it is very hard to modify the current html or css or JS Upvote 0
sorex said: is the data coming from something you host yourself? Click to expand... yes but i have small to no control over the content 1- i don't want to hide these elements for browser visitors (need to hide them only in my app webview) 2- i am using an eCommerce platform with caching it is very hard to modify the current html or css or JS
S sorex Expert Licensed User Longtime User Jan 15, 2020 #4 the problem is the way how things get executed by a browser and your injected js will be the last thing that will happen. you could hide it via (inline) css then it is immediatly gone but then you have problems with your none app connections. if it was an own product your could just send over a parameter to tell the backend it's coming from an app and then add the class hiding style to your html code. Upvote 0
the problem is the way how things get executed by a browser and your injected js will be the last thing that will happen. you could hide it via (inline) css then it is immediatly gone but then you have problems with your none app connections. if it was an own product your could just send over a parameter to tell the backend it's coming from an app and then add the class hiding style to your html code.
Jeffrey Cameron Well-Known Member Licensed User Longtime User Jan 15, 2020 #5 Admittedly, I'm not well-versed in the WebViewExtras control, but could you not make the control .Visible=False before you execute the LoadURL and WaitFor the _PageFinished event to make the control .Visible=True? Or does your added JavaScript not re-trigger the PageFinished again? Upvote 0
Admittedly, I'm not well-versed in the WebViewExtras control, but could you not make the control .Visible=False before you execute the LoadURL and WaitFor the _PageFinished event to make the control .Visible=True? Or does your added JavaScript not re-trigger the PageFinished again?
S sorex Expert Licensed User Longtime User Jan 15, 2020 #6 how can you hide something that doesn't even exist? he wants to load a page and then hide the item before the page is displayed. another option is download the code, change it and push it into the webview. but then session info wouldn't match. if this happends as first thing in the app then there won't be an issue as session will be created from the moment you click a link. Upvote 0
how can you hide something that doesn't even exist? he wants to load a page and then hide the item before the page is displayed. another option is download the code, change it and push it into the webview. but then session info wouldn't match. if this happends as first thing in the app then there won't be an issue as session will be created from the moment you click a link.
Jeffrey Cameron Well-Known Member Licensed User Longtime User Jan 16, 2020 #7 sorex said: how can you hide something that doesn't even exist? Click to expand... Code: 'pseudocode WebView1.Visible=False Webview1.LoadUrl("www.someplace.whatever") Wait For PageFinished(arguments) 'inject my java 'another wait for here or not, I've not used the WebView extras control Webview1.visible=True Upvote 0
sorex said: how can you hide something that doesn't even exist? Click to expand... Code: 'pseudocode WebView1.Visible=False Webview1.LoadUrl("www.someplace.whatever") Wait For PageFinished(arguments) 'inject my java 'another wait for here or not, I've not used the WebView extras control Webview1.visible=True
Devv Active Member Licensed User Longtime User Jan 16, 2020 #8 thanks for replay guys i had tried before to hide the web view until javascript is excited and it worked but it is not suitable for my app as it will make the browsing slower and it will not be beautiful to hide the webview on each click Upvote 0
thanks for replay guys i had tried before to hide the web view until javascript is excited and it worked but it is not suitable for my app as it will make the browsing slower and it will not be beautiful to hide the webview on each click
S sorex Expert Licensed User Longtime User Jan 16, 2020 #9 @Jeffrey Cameron : ok, I get your point now. I thought you meant hiding the item and then load another page and hide it again after pageload. but this is only valid for the first load then. Upvote 0
@Jeffrey Cameron : ok, I get your point now. I thought you meant hiding the item and then load another page and hide it again after pageload. but this is only valid for the first load then.
Devv Active Member Licensed User Longtime User Jan 16, 2020 #10 sorex said: how can you hide something that doesn't even exist? he wants to load a page and then hide the item before the page is displayed. another option is download the code, change it and push it into the webview. but then session info wouldn't match. if this happens as first thing in the app then there won't be an issue as session will be created from the moment you click a link. Click to expand... yes i think this would be our last hope to download the page source with okhttp then modify html then load it to webview via htmlload but it think this will cause problems sooner or later (specially that my website have caching and login features) Upvote 0
sorex said: how can you hide something that doesn't even exist? he wants to load a page and then hide the item before the page is displayed. another option is download the code, change it and push it into the webview. but then session info wouldn't match. if this happens as first thing in the app then there won't be an issue as session will be created from the moment you click a link. Click to expand... yes i think this would be our last hope to download the page source with okhttp then modify html then load it to webview via htmlload but it think this will cause problems sooner or later (specially that my website have caching and login features)
S sorex Expert Licensed User Longtime User Jan 16, 2020 #11 @Devv : Is this something that appears at every pageload? or only at the homepage? Upvote 0
Devv Active Member Licensed User Longtime User Jan 16, 2020 #12 sorex said: @Devv : Is this something that appears at every pageload? or only at the homepage? Click to expand... on every page load, it is the website header (language picker and sign in button) beisat.com Attachments Screenshot from 2020-01-16 11-44-54.png 69.8 KB · Views: 780 Upvote 0
sorex said: @Devv : Is this something that appears at every pageload? or only at the homepage? Click to expand... on every page load, it is the website header (language picker and sign in button) beisat.com
S sorex Expert Licensed User Longtime User Jan 16, 2020 #13 Can you enable a preloading animation in the webshop? Than you can abuse that to remove those elements before you hide the preloading overlay. Upvote 0
Can you enable a preloading animation in the webshop? Than you can abuse that to remove those elements before you hide the preloading overlay.
Devv Active Member Licensed User Longtime User Jan 16, 2020 #14 sorex said: Can you enable a preloading animation in the webshop? Than you can abuse that to remove those elements before you hide the preloading overlay. Click to expand... yes bro i already did that it worked for the home page only but the problem still remains with every page the user visit Upvote 0
sorex said: Can you enable a preloading animation in the webshop? Than you can abuse that to remove those elements before you hide the preloading overlay. Click to expand... yes bro i already did that it worked for the home page only but the problem still remains with every page the user visit
S sorex Expert Licensed User Longtime User Jan 16, 2020 #15 if you can't enable it for every page load then you're almost out of options. a last thing I can think of is reverse the logic. you always hide those elements and check the platform with javascript and if it's not Android fade in or display those elements. Upvote 0
if you can't enable it for every page load then you're almost out of options. a last thing I can think of is reverse the logic. you always hide those elements and check the platform with javascript and if it's not Android fade in or display those elements.
rraswisak Active Member Licensed User Longtime User Jan 16, 2020 #16 Devv said: WebViewExtra.ExecuteJavascript("document.getElementsByClassName('customer-signin-module')[0].remove();") Click to expand... what about this script, is still flickering ? Code: WebViewExtra.ExecuteJavascript("document.getElementsByClassName('customer-signin-module')[0].style.display = 'none';") Upvote 0
Devv said: WebViewExtra.ExecuteJavascript("document.getElementsByClassName('customer-signin-module')[0].remove();") Click to expand... what about this script, is still flickering ? Code: WebViewExtra.ExecuteJavascript("document.getElementsByClassName('customer-signin-module')[0].style.display = 'none';")
S sorex Expert Licensed User Longtime User Jan 16, 2020 #17 the problem is that it executes when those items are already visible during the loading. He wants to avoid that. Upvote 0
the problem is that it executes when those items are already visible during the loading. He wants to avoid that.
rraswisak Active Member Licensed User Longtime User Jan 16, 2020 #18 @sorex yes i know, since @Devv didn't tell us the url we can't try and see by the mean of "half of second... that make flicker quickly". I just wondering if using script above when execute on PageFinish is still flickering or not. ? Upvote 0
@sorex yes i know, since @Devv didn't tell us the url we can't try and see by the mean of "half of second... that make flicker quickly". I just wondering if using script above when execute on PageFinish is still flickering or not. ?
Devv Active Member Licensed User Longtime User Jan 16, 2020 #19 rraswisak said: what about this script, is still flickering ? Code: WebViewExtra.ExecuteJavascript("document.getElementsByClassName('customer-signin-module')[0].style.display = 'none';") Click to expand... yup still the same Upvote 0
rraswisak said: what about this script, is still flickering ? Code: WebViewExtra.ExecuteJavascript("document.getElementsByClassName('customer-signin-module')[0].style.display = 'none';") Click to expand... yup still the same
Devv Active Member Licensed User Longtime User Jan 16, 2020 #20 rraswisak said: @sorex yes i know, since @Devv didn't tell us the url we can't try and see by the mean of "half of second... that make flicker quickly". I just wondering if using script above when execute on PageFinish is still flickering or not. ? Click to expand... hello here is the url beisat.com Upvote 0
rraswisak said: @sorex yes i know, since @Devv didn't tell us the url we can't try and see by the mean of "half of second... that make flicker quickly". I just wondering if using script above when execute on PageFinish is still flickering or not. ? Click to expand... hello here is the url beisat.com