An applet gains focus when loaded, preventing browser keystrokes from working. You can work around this by adding a parameter to the applet tag:
name="initial_focus" value="false"
So far so good. But when the user clicks on the applet even if the applet does not have any user interface controls, then the problem remains.
I guess another way to phrase the question is: How can I get the applet to forward all keystrokes back to the browser?
You can attach a button click handler to the parts of your application that doesn't have a UI (for example your root pane), and execute a piece of javascript code that will be run by the browser, delegating the focus to some HTML DOM element instead.
Related
I'm using Playwright (Java) to drive a particular third-party Web site, the first page of which apparently containing two images which are password protected; this causes a sequence of basic-authentication dialogs to open when the page loads.
I'd like the script to dismiss these dialogs (cancel), rather than providing any credentials, and then continue working with the page. But as it stands now, the page.navigate() blocks and eventually times out, unless I cancel these dialogs manually with the mouse.
Note that this is the native browser dialog, not anything generated from js on the page.
Is this possible with Playwright?
Interestingly, I was able to work around this by disabling images entirely in Chrome, which might have other (performance) benefits, too.
Added this to the array of Chrome startup arguments:
--blink-settings=imagesEnabled=false
Of course, this only solved this specific case, in which the login prompts were being triggered by image URLs.
I'm using using a TWebBrowser in a FireMonkey app (Delphi 10.3.3) and loading some dynamic HTML into it like this
DocumentWebBrowser.LoadFromStrings(browser_html,'');
In that HTML I have several links like
<a id="position_26" class="cdimmed" href="pos_26">SOME WORD</a>
I need to intercept when the user follows that link, without loading new HTML (just by running some JavaScript). DocumentWebBrowserShouldStartLoadWithRequest is never triggered. DocumentWebBrowserDidStartLoad is triggered, but I didn't find a way to stop the browser to stop the navigation. I tried calling Stop, FinishLoading and FailLoadingWithError without success. Any way to achieve this (without using CEF4)?
I want to add back and forward navigation button to my browserWindow in my Electron App, but although with Firefox and chrome when we use the back navigation any form input are reloaded with cached data with Electron webview using goBack()function clear these everytime. Is there any setup, options or way of keeping the data ....
It isn't clear.
Electron documentation doesn't explicitly state whether Electron implements what is called BFCache or HistoryLists.
It isn't clear from Electron source code either. I created relevant issue on Github.
Electron uses Chromium to implement BrowserWindow. Situation with BFCache and Chromium itself isn't very clear. There are multiple issues that state
that BFCache isn't implemented in Chromium (455226 Chrome reinitializes all fields to the value they had on their initial presentation when history back is used, 510340 Investigate faster back/forward page navigation). Although I've seen in practice that BFCache works in Chrome.
You can save and restore form state using JavaScript, sessionStorage and window load and unload events. But in this case you also need a mechanism to clearly identify input nodes and store serialized files in case if form contains file inputs.
For more information check:
You Do Not Understand Browser History article by Matthew Beale
Window.sessionStorage MDN page
MDN page about BFCache
I know there is a MessageBox class in the isolate library but that is not what I need. I am looking for the pop-up style messagebox functionality found in desktop windows apps (i.e. WinForm apps) where you ask a simple confirmation question and the user can click a yes or no button in response. Is there an equivalent in Dart, if not can anyone suggest some alternatives?
You can display a message box easily with :
window.alert('test');
don't forget this in the top of your file:
import 'dart:html';
This will behave like the alert function in JavaScript. If you want to add buttons (other then the default "ok" button) to your message window, then you will need to make a custom window, which would not be very hard. You create an element which you add to your document body. This element should be absolute positionned. Adding an overlay in front of your document will be useful to prevent user clicks on the page.
this is in javascript, but it is useful to know what to do with dom and css :
http://raventools.com/blog/create-a-modal-dialog-using-css-and-javascript/
I want to open a web page at default browser at a specific position and also open another webpages at that one, not new task of that browser. maybe user opens new task of that browser but by clicking a button in my delphi program the selected web page have to open at first one. is that possible? my company wants me to program such thing BUT I do not know how to do. I really appricate any help. thanks.
There are instructions here to open the default browser, but you may even be able to "run" a url, as you can from the Windows run command. You then need to retain the handle of that process so that you can do something with it.
To open a web page at a particular point you would ideally use a named anchor in the page, ie, the bit after a hash: http://www.w3schools.com/TAGS/tryit.asp?filename=tryhtml_a_name If you don't have control of the page and there are no named anchors you could try scrolling: How to scroll the scrollbar in external application via WinAPI?