after much research I've been trying to find a code that not only captures popup links in the webbrowser for it to navigate in, but also works on javascript codes that open new windows or popups.
i tried using the webbrowser1_newwindow event with the following code (and works great)
' prevent opening a new window
e.Cancel = True
WBAccountVirgin.Navigate(e.Url.ToString)
but it doesn't work with javascript code using:
javascript:newPopup
i managed to remove the javascript code as a string and just navigate to that and also works but not every time.
So here's the question:
What code can i use that works with every sort of newwindow event or popup where i don't need to provide the url beforehand of that popup? Also that works with javascript popup codes..
I've seen that most places people offer the solution of using the NewWindow2 and NewWindow3 event but that isn't even part of the pre-loaded Webbrowser control which i am using. I don't want to use the Microsoft Webbrowser that i have to import. I want to use the WebBrowser Control which is already loaded.
Related
I am trying to click on page two using JS
https://www.abbreviations.com/sr
So I opened the console and put
document.getElementsByClassName('rc5')[1].click();
But it didn't click it and go to that page
This worked for me:
document.querySelectorAll(".pager > .rc5")[1].click()
what kind action you want to get as your 'click' result? first, it may be important to determine, that browser defines clicks as 'native' and 'generated by the code' and in the case of security and browsers policies.
but there is one smart method to work with DOM - headless browsers, like puppeteer.
you can do really anything with the webpage, using pure javascript.
I am the developer of Boxy, a famous native wrapper around Inbox by Gmail, and wanted to ask if anyone is able to help with something I have been struggling with since day one of development.
Here is the problem: links on inbox.google.com and gmail.com work differently than on other sites: clicking on them does not trigger a navigation action on my webview (I am using a WKWebView specifically, but the problem is also present using the old WebView). So I am having a difficult time opening links in an external browser when appropriate.
Because of this, at the time of this writing, I am relying on a terrible hack in order to open links: intercepting clicks on the document.body with javascript (using an event listener) and then forcing them to open on the external browser by calling the native app.
My best guess is that the Gmail/Inbox apps perform some javascript magic in order to track clicks on all the links inside emails and that, somehow, this interfers with the standard behaviour.
Has anyone got any idea how I can solve this problem?
Things I already tried
Implementing the method -webView:createWebViewWithConfiguration:forNavigationAction:windowFeatures: of WKUIDelegate. Did not work: the method is called but the request associated with the navigation action is empty.
I found a solution. This issue is due to when clicking link, instead of opening using target=_blank, Gmail attempts to open an about:blank window and then run javascript to redirect the link.
You need to make sure that Gmail can correctly receive the handle of the created window.
- (WKWebView *)webView:(WebUI *)webView
createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration
forNavigationAction:(WKNavigationAction *)navigationAction
windowFeatures:(WKWindowFeatures *)windowFeatures
You need to make sure this delegate method correctly returns the newly created wkwebview.
I am working on a website where I have to repetitively attach an image file one by one and click submit for it to be uploaded. I looked at site's JavaScript code and found the right buttons, and I even used AHK's COM object tutorial here to click() those buttons using JavaScript. I wanted to know is there any sophisticated way to control webpages using javascripts from user's end on browser other than Internet Explorer?
(I am looking for something better than putting focus on url-bar, and typing javascript:alert())
I was navigating on this page and clicked "Available for your computer" image.
Then a native browser popup that is like an alert was opened:
Please compare the one above with the following alert() that everybody knows:
How did they create such an alert?
alert seems not to support images, according to this question.
Is this possible to open with JavaScript? I guess yes, but how?
Is this cross-browser? On Firefox, I am redirected to Chrome download page.
NOTE: I DO know that there are a lot of JavaScript libraries to show alerts, but I DO NOT want to use any of them. I want a clear answer to my question.
Chrome has some specialized windows/popups available for it's own use .. things you can't do via regular JavaScript.
Other things you can't do via regular JavaScript are the
Enable Webcam prompt window
Download file window.
If you are trying to do something similar in pure JavaScript, this is a great little replacement:
http://www.codersgrid.com/2013/07/05/alertify-js-replacement-of-your-browser-alert-dialog/
This seems to be a "chrome specific" popup. The application you want to install by clicking on this button is a Google App, which install is handled by Chrome. I think.
Except Bootstrap-like modals, I have never seen such thing in Javascript before.
Check this if you want to implement such popups on your website:
http://getbootstrap.com/javascript/#modals
instead of using alert . you can use any external plugin confirm box.Then you can customize your dialog box
So we have an internal web app that was written back in the IE6 days that we are trying to get to a state where it will work cross-browser, including mobile devices. We are using ASP.NET and the codebehind is written in VB.NET.
Unfortunately the app uses the showModalDialog function that only really works in Internet Explorer (and sort of in Firefox) all over the place. It also makes use of the window.returnValue from these popups, so what it expects is that when PopUpWindow() is called, the javascript would block on that statement and stop execution. Most calls are of the form "var a = PopUpWindow(..)". Then when the popup is closed, it would resume and set a to the returnValue and then make use of it.
It looks like these days javascript doesn't really do blocking function calls, which is making the process of finding an easy cross-browser replacement frustrating. We have a javascript file that is included on every page that contains the function that opens the popup windows. We would ideally like to replace this function in this file and have it work across the application without having to make changes on every single page where there is a popup.
Is there anything that would help with this or is there a standard way of replacing these kinds of dialog popups? We are looking at replacing them with jQuery dialogs but since we would need to use a callback function to get the returnValue it wouldn't work as a drop-in replacement. I'm getting the feeling that there is no easy way to do this (since our code relies on blocking javascript) and we will have to bite the bullet and make the changes to each page with a popup.
You can use my showModalDialog polyfill using a modal <dialog> element, which works in the latest Google Chrome. For other browsers, a <dialog> polyfill is available.