Scrolling in Webview Progmatically - javascript

I am having a webview which dispalys large amounbt of data. I want to scroll Webview progmatically. I know window.scrollto() method is there but ,god knows why, it is not working. Can anybody guide me step by step how to do this ? I am sure there is some minor problem. Pl. guide me.

simplest possible way i am aware about is adding url?param=value#id technique. I am not sure is you are looking for this but it works nicely. This is called fragment identifier

I think that you may have a syntax error. Its element.scrollTo(x-coord, y-coord) :)
Sample code would be useful if you have some for us.
Is it the actual window that has a scroll or is it some element inside the window that has a scroll.
You should try to alert your x-coord and y-coord just before you call scrollTo() to see if there are actual values there.

Related

What causes a function to run in the console but not when it is invoked by an event listener?

EDIT
Added a link to a sandbox with working code. For some reason it seems to be working in the sandbox in the same browser it wont work on?!?!
CodeSandbox Demo
I am experiencing this weird issue of invoking a function in the console and it working as expected. However, when I invoke the function via an event listener it breaks the element.
The element is a canvas that is drawing different "bodies" on to it over a set interval.
Why would cause this function to work in the console but not in the document?
Two questions and then I might be able to help you.
Number 1: Are you using a library like p5.js or are you drawing it straight onto the canvas?
Number 2: Could you please post the code, as there might be an error?
Also if you want a quick solution, try using a different browser (although this might not be the solution, it is worth a try), such as Firefox Developer Edition, or just regular Firefox.
Hope this is helpful!

zipcode checker with iframe in combination with Javascript

I have a problem with my site, it's based on Joomla 2.5.16
I will try to explain my problem as good as possible.
On my site i have a zipcode checker, were people can check the availability of fiber to the home.
The zipcode checker works with a iframe, in combination with a javascript code that i put in the header.
The Javascript code determines the height of the iframe. as you can see at www.nederlandkiestvoorglasvezel.nl/glasvezel-vergelijken the height of the iframe is wrong. it seems like something be overwritten the javascriptcode.
Cause when i test the iframe and the javascriptcode outside Joomla, de zipcode checker works fine. you can see it here: http://www.nederlandkiestvoorglasvezel.nl/iframeTest.htm
However, seem to have received to be erroneous data, yet overwritten the same code in your Joomla site the correct value, I see no reason after another everything after passing the following:
Parent reveived message!: 440
So I hope someone can tell whats the problem, i have tried several opties and got help from my hosting but we can't fix it.
Regards,
Rutger
I hope it's as silly as this. Look at the height you've set in the iframe with something like firebug. You'll notice that the height property is set to {"s":"__cb","f":"oauth2relay368429625","c":0,"a":[40,false],"t":"852486603","l":false,"g":true,"r":"oauth2relay368429625"}px.
You should probably fix that, and then it'll work :)
Edit - more details. This chunk of code is causing it:
// Listen to message from child window
eventer(messageEvent,function(e) {
console.log('parent received message!: ',e.data);
document.getElementById('internetdealerframe').height = e.data + 'px';
},false);
Since you're passing around more than just a number, the entire string is being used as a height.
Edit #2
It doesn't look like you're actually passing a valid height anywhere in those postMessage calls - The first one that has any kind of 'height' in it contains the following: !_{"s":"/I0_1387279282212::_renderstart","f":"I0_1387279282212","r":"I0_1387279282212","t":"24007401","a":[{"height":20,"width":90,"title":"+1"}],"g":false}. And I'm thinking that you don't actually want the iframe to be 20 pixels high.
Thanks for your answer, but i dont get it,
Cause at my test iframe, outside Joomla, de height works.. as you can see at, http://www.nederlandkiestvoorglasvezel.nl/iframeTest.htm

how to, javascript Pop Under not popping in the background

i have this simple script of a popunder window:
function loadpopunder(){
win2=window.open(popunder,"",winfeatures)
win2.blur()
window.focus()
}
It works but it looks like the new window doesn't load under the main one. it loads on top.
i've been looking at this from multiple ways and i can't figure it out.
any ideas?
thanks
edit: this code is just a sample, mine actually has all the ; and the http://.. link,
also, i understand that none likes the popunders, i don't like them either, is just one of those things that needs to be done. I hope one day someone will figure a way of blocking those too, but i am here bcause i am looking for a solution
Please reconsider your choice. There are about zero people that enjoy pop-unders.
For the sake of answering your question, here is what's considered a better way: http://icant.co.uk/articles/how-to-create-popunders/

IE 8 Frameset / Javascript error

Ok here's the problem. I have a page that works in FF3 and Safari4 no problem. It's IE8 that's causing the issue, go figure. I remember in the Netscape days when it was the opposite.
Anyways,
So i'm building a website for a friend - i have three pages. the first two work fine on their own, but when they are combined in a frameset in the third (main.html) in IE8 all hell breaks loose. here are the pages:
www.wither.org/Karoline/navigation.html
www.wither.org/Karoline/portfolio.html
http://www.wither.org/Karoline/main.html
& my CSS if you want it: www.wither.org/Karoline/css/styles.css
if anyone can figure out how to fix this, i'd be eternally grateful. It's completely baffling to me and i've tried all kinds of options. i upgraded jquery to the latest version but then my scroller didn't work and i can't dive too much into the javascript code right now.
Please if you could help out, it would mean a lot to me. this has to go live sometime tomorrow.
There is a JS error when executing the following line of code document.getElementById("loading").style.display = 'none';
in the portfolio page.
Apparently, the element with id 'loading' is not being found. However, if I continue execution of the JavaScript on the page (from within the debugger), there are no issues, and the behavior is the same as in Firefox. This is indicative of a concurrency issue - the element 'loading' is not present in the DOM yet, but the script is attempting to change the element's style.
In order to fix this issue, you will have to ensure that the 'loading' element is present in the DOM before its style is being changed. In fact, you could delay the execution of the onload event handler (using window.setTimeout), until a point where the element is present in the DOM.
What's the actual javascript error?
And IE does have an issue in regards to invalid/broken markup inside of frames, I would try
a) commenting out each script and see which causes the js error
b) if commenting out all the js did nothing it might be related to the invalid markup inside of a frame issue, in which case I'd ditch frames alltogether.
yeah....
so thanks so much for your help. problem solved and i figured the other CSS error. should have picked up on that one earlier.
so site is working and if you want to see what happened with your help,
http://www.wither.org/Karoline
it works perfectly cross platform. made the deadline with hours to spare. thanks SO much. can't believe how well this worked.

Javascript : is null or not an object

I was having a problem with IE finding both secure and non-secure items on a page. This seems to have been sorted thanks to a solution by David (many thanks!) who suggested altering the JS we use to display a gallery of images at the top of the page.
The issue now is that the gallery doesn't work!
Here's the error message:
Webpage error details
Message: 'this.galleryData.0.image' is null or not an object
Line: 266
Char: 4
Code: 0
URI: https://www.droverholidays.co.uk/scripts/jd.gallery.js
The page is:
https://www.droverholidays.co.uk/bikehireform.php
I don't understand JS very well so it would be great if anyone can tell me what I need to do to make this work!
In bikehireform.php change the line that says
startGallery();
to
window.addEvent('domready', startGallery);
In looking at your other question, I personally think CptSkippy's answer is still the correct one.
Stick with the onDomReady approach and make sure your external assets are being loaded from http***s***
Wow... I think I may have got it. I substituted 'load' for 'domready' in Rob's solution, above, and now I don't get the IE warning, and the script works. It seems to be a bit slower than before, would that make sense?

Categories

Resources