I'm trying to scroll a website (x and y) without scrollbar. I tryed a lot of codes, but it doesn't work. Can you help me please?
Asked
Active
Viewed 332 times
0
-
1"I tryed a lot", such as ? – Paul Zahra Oct 14 '14 at 09:23
-
I tryed a lot of script. Sorry I'm not english D: – ottovolante321 Oct 14 '14 at 09:24
-
Read http://stackoverflow.com/questions/6677035/jquery-scroll-to-element – Paul Zahra Oct 14 '14 at 09:30
-
@ottovolante321 - He means show us source code. (Either to be able to correct your errors or to show us some effort.) "Tried a lot of codes." - could mean you have used them in a wrong manner, and "it doesn't work" could mean lots of things and unusable without error message, exception message or error code. – mg30rg Oct 14 '14 at 09:31
-
Exactly, see http://stackoverflow.com/help/mcve – Albireo Oct 14 '14 at 12:09
-
I know I know but please tell me how to execute javascript code into a webbrowser by using C# – ottovolante321 Oct 14 '14 at 12:24
2 Answers
0
To My Knowledge you cannot do this from C# side.
You can however run something in javascript like
window.scrollTo(xPos,yPos);
and if you really want to do this from C#, I'd suggest looking into registering scripts to run on the client, Although this can get messy fast. As Comments are suggesting it is hard to help you on your exact problem because we would need to see some code for what you have tried and where you problem domain lies.

Steven Dall
- 174
- 2
- 15
-
I'm not at home now. But I will try it. Thank you very match. ☺ – ottovolante321 Oct 14 '14 at 09:39
-
There is a C# code to execute java script code in a Web browser? – ottovolante321 Oct 14 '14 at 09:42
0
I Found a method to do that.
HtmlElement head = webBrowser1.Document.GetElementsByTagName("head")[0];
HtmlElement s = webBrowser1.Document.CreateElement("script");
s.SetAttribute("text", "function functionName() { /* Code to Execute in JS */ }");
head.AppendChild(s);
webBrowser1.Document.InvokeScript("functionName");
Remember to execute this code after about five second that the website correctly load. A special thank to Steven Dall

ottovolante321
- 19
- 6