What is the browser equivalent of autocomplete="off" for all input fields? - html

We have an existing web application with hundreds of input fields through different applications that has been installed at several sites. At this most recent site, however, we have started having an issue with the back button automatically filling in input fields. This is an issue because the only time we allow the back button is if an error occurred in processing. So the flow is as follows:
1) ask user to scan a barcode
2) an error occurs on the back-end and it directs them to an error page with only a back button
3) the user hits back and is directed to the input page, input form is now filled with the previously inputted data.
I know this is some form of caching or browser issue because when I hit the web app from my personal pc, it doesn't do it. But when they use their android scanning devices and if we load it up on the application server, it does.
I have fixed this on a couple of pages with autocomplete="off" on the input fields, but it just isn't feasible for us to change this on each of hundreds of input fields if we can avoid it. I'm looking for some browser or windows function to turn off to disable this.
I have tried turning off all of the chrome autocomplete fields, and I have tried disabling the cache in dev tools with no luck. Is there another way to disable this without using that autocomplete tag?

If inputs are inside form you can put it on form.
If not you've only one option to use a global script to add attribute on each input something like below but it'll put it on every input and I'm not sure if it'll have any side effects for your case:
field.setAttribute( "autocomplete", "new-password" );
Hope it helps.

Related

Is there a browser tab identifier that I can set or use locally?

(I am developing a Node.js/Express web application.)
Is there a way to identify a tab and have its identifier saved locally in the browser so that the identifier is persistent across different pages of the same web site?
Example, my web application is opened by the user in two tabs of the same browser. I would like to know that they are opened in different tabs. Even if the user in tab A presses F5 to refresh the page, I (in the client Javascript) would like to know that the page is still in tab A.
Is there a property of window or another object in the DOM that identifies the browser tab?
Nothing simple. However, there are two interesting technologies that may help you solve your problem.
sessionStorage is the closest to what you described. It gives each tab a different Storage object that you can store random IDs in. It doesn't quite work though, because when you open a link in a new tab the second tab gets a copy of the parent page's sessionStorage object, including whatever you stored in the parent page's sessionStorage.
The storage event is probably what you want to use. You can have your tabs communicate directly with each other to coordinate unique IDs or detect multiple tabs being open. See this question which is focused on how to communicate across tabs in javascript.
Some combination of these two technologies will probably help you solve whatever you are trying to accomplish.

Use window.name to open links in emails in the same tab

I am developing a web site where users can change settings which they have to confirm before taking effect.
The confirmation is done by a link I send them via E-Mail. In the HTML of the website I use this little snippet:
<script type="text/javascript">window.name="mysite";</script>
And in the HTML emails I use
Click me
But Chrome is always opening new tabs instead of opening them all in one.
Is this even possible or is it forbidden for some reasons?
Webmail platforms such as Gmail tend to modify some of the HTML code of an email due to security reasons.
They obviously remove any javascript code the email could have. But they also change (or add if none) the target property of every anchor element and set them to target="_blank" in order to avoid the user to be taken out of Gmail (in this case).
Unfortunately every webmail platform has their own behavior, therefore, what you want to do is not gonna work on every webmail platform.
If what you want to do is prevent the user from having multiple tabs of the same page opened, (*please refer to Update 1) it comes to mind you could use web sockets to close the previous tab once the user enters in the URL sent by email. Have a look at socket.io for example.
Update 1
There's no way to do this using WebSockets. There's no possible way to close a window that wasn't opened using javascript, and it can only be closed by it's parents.
That is a very interesting idea. I like it. Alas, it appears that, in modern browsers, you can no longer close a window you didn't open through javascript. So if you aren't allowed to run javascript in the email, the best you can do is to redirect the original page to a "thank you" page and leave it hanging around in the browser's tab (but no longer waiting on conformation). Like this:
PleaseConfirm.html:
window.name="need_redirected";
Confirm.html:
var w = window.open("", "need_redirected");
if (w)
w.location="ThankYou.html";
Of course, for old IE, I'd still try to close the old window in ThankYou.html:
window.top.close();
You can still try to set the target, of course, just in case it works, and you can always try putting an onclick attribute on your tag for the same reason:
click here
But that seems to be the best you can do. Bummer.
Neither of the other two answers work, but this one probably will:
In the initial tab, listen for an onstorage event, with a certain key being created, e.g. "userHasConfirmedEmail". When the event occurs, window.top.close().
In the new tab, create that key.
Credit goes to Tomas and his answer.

Microsoft Access form opens minimised after its been changed

Im having an intermittent problem where forms open in view mode but minimised, looking like a small inch-sized box with the 'X' close button visible.
It normally seems to happen when Ive made a change to the form or code in the forms module, but happens randomly when being used in view mode.
I can only get round it by either re-importing a backup of the form or making the form border sizeable, either way it's not too professional.
Any ideas how I can solve this one?
Docmd.Restore seems to work on the form load event

Populating Request on Back Button Click

So I am running into an issue. I have certain fields that I store within the request from page to page, because each page requires different fields to be populated within a collector that I used cross-page. The problem is the back button.
If I click the link to take my to my login page, the server populates the collector from the request with the appropriate pagename and event name, etc., to allow me to navigate to the login page. (Certain things have to load, so it has to go through a servlet). However, on that page, there are static modules for ads and whatnot, so clicking on one of the ads will take you to a separate, static page that does not require these attributes to access. In Chrome, Safari and FF, if I click the back button after accessing this static page, the browser asks me to reload the request to be able to view the page. In IE8, however, there is no page reload. It just kicks me back to the page, and does not populate the request, and it crashes with my sorry page.
I need to know if there is a way to populate the request on the back button click, and how to do so. Otherwise, my servlet is throwing a null pointer when trying to access the fields because they are all null in the request. Any help would be greatly appreciated. I am not even sure if this is at all possible.
I guess you are using POST requests to navigate to each page. POST should be used only to send some user action different from page view - login, buying something, changing settings, etc. The browsers require the user to confirm that they want to revisit a page using POST, before that implies state change. See What is the difference between POST and GET?
For simple content pages, where the user does not take action, it's better to use GET requests. Also, it is much more common to use request.getSession() to get and store the user fields on the server side. That is, you only send them once, and then look them up for each request. Look up for tutorials on session tracking in java.

Auto suggest with Rendering issue

I have an issue in our currently running .net application. we are using autocomplete extender control associated with city textbox for city selection. Due to slow internet connection, when user uses this application with partially rendered, it is not suggesting for entered city (highlighted in red).
I have used Page_Init event for first disable the textbox, than enable it on Page_Load, but it's not working (to prevent user for enter text when the page is not loaded completely).
Is there any solution to overcome this problem?
After loaded successfully,
So you want to disable the textboxes until the page has loaded? I am not sure if it will work like you want but have you considered using jQuery to disable the textbox? For example here, here, here