1

I use Chrome. On some sites it seems that it remembers an immense number of entries for different fields. I find it very handy. However, on some sites, it doesn't do so well. One example that is driving me crazy is on the AWS console. When updating a Lambda function I need to copy a file over from S3. There is a field that requires a very long URL that I have to go retrieve elsewhere every time. AWS Lambda Screenshot

The HTML for the field is:

<input type="text" autocomplete="on" id="awsui-textfield-5"
class="awsui-textfield awsui-textfield-type-text">

Because of the autocomplete="on" I would expect Chrome to just "do the right thing™", but maybe because the field is not in a <form> it's not.

What conditions must occur in order to have a field be saved?

I frequently make bookmarklets or userscripts to solve little annoyances with websites. I would love to do that here, but I don't know what needs to change.

Please advise.

migrated from webapps.stackexchange.com Apr 18 '17 at 1:51

This question came from our site for power users of web applications.

0

I have solved it for this one case! I think the solution will probably apply to many others. I made a bookmarklet and chunk of javascript that you can paste into a "Developer Tools" console.

var jq_tag=document.createElement('script');
jq_tag.setAttribute('src','//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.0/jquery.min.js');
document.head.appendChild(jq_tag);
setTimeout(function() {
  var tf=$(document.activeElement);
  var ff=$('<form method="post" target="_blank" action="//example.com"><input type="submit" value="Save this field data"></form>');
  tf.after(ff);
  ff.prepend(tf);
}, 2000);

By design (to make it more general purpose), it requires that you have your cursor in the text field in question. When you run the JS, a "Save this field data" button will appear after the field.

This is a breakdown of what it is doing line by line:

# Create a script tag in memory.
# Make it source jQuery.
# Attach it to do the <head> of the document which begins loading it.
# Barbaric workaround for waiting for the JS to load.
# Get the element that has focus.
# Create a form that will POST to example.com in a new tab.
# Attach the form to the DOM right after the "focused element".
# Detach the "focused element" and reattach it inside the new form element.

Here is it in action... enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.