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
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 Kendo UI Mobile Framework and have the bulk of my views handled as remote views. For example, a remote html doc view1.html instead of an inline div element #view1.
They all work fine in the browser, however I see some problems related to caching of these remote views:
Reloading the home screen app after closing it doesn't force the web app contents to refresh/update (iOS Saved to home screen).
Recreating the home screen web app doesn't force the contents to refresh/update, even after clearing the Safari web data (iOS Saved to home screen).
Does anyone know how to force the app to fetch new versions of these remote views on initial application load (once per session) when that is all taken care of behind the scenes in the Kendo Mobile Library?
I was looking into ApplicationCache but that seems pretty scary for my mostly dynamic, database intensive app. On top of this, I don't think my webserver (which runs off the back of a 4D database can actually serve the correct mime-type for appcache files).
Since Kendo UI is using jQuery:
https://github.com/telerik/kendo-ui-core/blob/master/src/kendo.mobile.view.js#L660
you can probably stop the cache with the global $.ajaxSetup(), like this:
$.ajaxSetup({
cache: false
});
Just make sure to switch it off before loading any other data you need.
I've got a website that I'm converting into an app using JQM. I've read about Pages and how the DOM loads but I'm still uncertain how to architect the site.
The main page of the application is based on the Google Maps API which uses JS to load. There are 150+ target pages so I don't want them to load until the user taps the link. All of the target pages also require JS to initialize. When they return to the main page the cached state should be the default but I also need the option to run JS if the query string changes. Content doesn't change often so my preference would be to cache data once loaded but there would need to be some way to flush the cache.
I converted the site to JQM. The target page JS didn't run so I added rel='external' to the links. The JS now runs on the target but when I link back to the main page it reloads the page without running initializing the JS. The obvious solution would be to add rel="external" but then I'd be defeating all performance value. Any recommendations on how I should structure it?
Using rel=external your links will not be loaded with Ajax and you will lose animated page transitions. If you want to run some script when a page displays, use this page event:
$(document).on("pageshow", "#selector", function(event, ui) { /* your code */ });
This and other useful events are described in jQuery Mobile API Documentation.
For example, pagecreate (the now deprecated pageinit) is called once when the page initializes.
About getting query string parameters, see this answer.
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?
If one uses remoteFunction or one of the the Grails Ajax capabilities, rendering a template to update a portion of a page, how does one see any additions made to the Javascript functions associated with the resulting page in Chrome or Firefox?
In Chrome, one is able to see the updated page/DOM via going to their Tools -> Developer Tools menu item, then selecting "Elements". There, I'm able to use the magnifying glass to select a portion of the updated page that I want to see. But, how do I also see the additional Javascript functions added to the page.
NOTE: Originally this question requested to see both html element content and Javascript content. Karthick AK's answer handles both.
In Chrome->Developer tool-> Network tab,
For each request being sent the response obtained can be seen in the Response tab. The rendered content can be seen in here.
Similiar option exists for firefox/firebug.
Another ajax gotcha i have experienced is, sometimes the ajax requests are cached and hence onclick the content is served from the cache and not an actual requests hits the server. This is more prominant in Old IE browsers