I was hoping that someone could answer me a question, I don't need any code but more a helpful direction to start researching.
Here is my situation
I have a windows Form program that if I placed a button control on and a web browser control on. The web browser will have a page in it that is mostly javascript driven..now lets say thru javascipt on the web page I created a checkbox control on the webpage. Is there any way I could get my button control on my windows form to check that box? Im sorry if I am not explaining myself right still getting used to the lingo.
Thanks in advance guys
This site is a wealth of knowledge.
I assume you have WebBrowser control. Handle it's DocumentCompleted event and start you work here. Now you can work with WebBrowser.Document, WebBrowser.Document.Body to interact with your page.
For example, you can use wb.Document.InvokeScript with some parameters to handle the updates.
Or you can go directly
wb.Document.GetElementById("your_Element_ID").SetAttribute("checked", "checked")
Related
Hi I am trying to figure out if there is any way to disable the browser navigation bar so that the user is not able to reload the url or unable to the click on browser reload . I tried to find the solution but I could only see like this below in most of the sites .
window.open('URL', 'null', 'width=900,height=750,toolbar=no,scrollbars=no,location=no,resizable =no');
window.moveTo(0, 0);
I am trying to find the solution using Java Script or JQuery and learn in the process. In my application after the first page and after click on submit button then the second page is OTP page and I want to not show the navigation bar or not to allow the user to reload the page while entering the OTP . I am hardly find the solution and any help would be appreciated.
Most of the browsers dont have that feature or has that feature but not turned on due to user experience concerns. It could be easily exploited by hackers so its usually not possible for safety concerns
I need to navigate through a particular website, frequently, to get at some sub-page that is several layers beyond the front page and it is taking too much time to click and scroll and click and scroll to get at the desired final screen where I enter the search string. So, I would like to automate the process by making Javascript trigger the right button events to get me to the distant page where I can enter the search string manually.
So, I know how the code needed to trigger the event,
document.getElementById('x').click();
but how can I implement this inside my browser, since this is not my own website?
If this is going thru different pages, then probably a Web UI automation tool would be the best (like Selenium - http://www.seleniumhq.org).
as #elcarns says, if you need to inject code into another's website, you could do so opening the console (view --> developers --> javascript console in Chrome).
Another, more complex way to do it when you have to traverse several pages is by developing a plugin.
javascript:document.getElementById('x').click(); in the url bar. You can probably make a bookmarklet for it as well.
I use a lot of JavaScript on my site (currently under construction). My worry is if some of the client side's system has JavaScript disabled then my site will "miserably fail".
I know that we cannot programatically override to enable JavaScript as it would be a security issue. But what I want is if the client side system has JavaScript disabled then a popup should appear with a button so that when the user clicks the button automatically JS will be enabled no matter in what browser he is viewing the site.
I am asking this because I saw the same thing myself when I viewed some other site.
That is not possible. You can however display instructions on the page on how to enable JavaScript, but considering that people who disable JavaScript usually know what they are doing they'll know how to enable it themselves.
I'd say there are very few people who accidentally disable JavaScript, so your worries are probably unnecessary.
Well if you want a popup to appear then you need to make it happen using javascript, so I guess the answer is that you can just ignore the very small percentage of people who have javascript disabled for their browsers.
What you are probably looking for is Progressive enhancement.
Instead of showing a message through JavaScript that tells the user to enable JavaScript you do it the other way around.
By default you show a message, in a div for example, and when JavaScript is enabled you hide the div. You only use JavaScript to enhance the user experience but offer a 'reasonable' experience when the user doesn't have JavaScript enabled. Reasonable could mean in your case an empty page with some text that explains why you really need JavaScript.
I'm trying to use history.back() inside of my Facebook app to go up our site hierarchy since the browser back button is obviously useless in this sort of situation. I'm using javascript to avoid having to manage history site on the backend but it's proving to be very buggy. Clicking a link with href="javascript:history.back()"causes the page to scroll around a couple times then actually causes top to go back...
Any help with this subject is greatly appreciated.
So it turns out that history.back() is not possible due to the way Facebook hacks around with the iframes that run apps. I ended up having to implement a pseudo-back link via an implementation in the server-side framework I was using.
I'm writing a suite of admin tools to sit on top of our existing site that will allow a user to quickly administer a number of pages from one convenient jquery ui window.
The issue I'm running into is that a lot of the functionality requires postbacks on specific pages, while this admin overlay can be accessed from any page. This means that in order for the functionality to work, the postback has to be sent to the correct page (or the page has to be loaded before the postback is triggered).
I've looked at Causing a PostBack to a different page from a PopUp and several c# posts, but they do not appear to address the specific issue of moving to another page prior to firing the postback using javascript.
Possible Solution: one solution I considered is using cookies transmit information about which postback events need to fire and what parameters to use while using javascript to load the correct page. It's not a great solution, so I was wondering if anyone here could think of a better one.