-2

I want to create an creditcard autofill for shopify pages. My plan was to fill the cardnumber input field (for example) with document.getElementById('number').value = 12355444;

I've made two Observations: 1.) If I write it in the console nothing happens untill I do a right click in the specific input field and press inspect. After inspecting and executing in browser-console input-field will get filled. But why do I have to inspect the field first?

2.) If I execute the document.getElementById('number').value = 12355444; over my little Chrome-extension I'll get the error: Uncaught TypeError: Cannot set properties of null (setting 'value') at :1:53

How do i get it worked?, it seems like I cant access or it doesnt find the ID's of the input-form.

If you want to try it out, take for example: https://newtonsupplyco.com/ cart sth and go untill payment.

Thank you

Mahal
  • 7
  • 2
  • 2
    How are you creating a credit-card auto-fill? Where is the CC info coming from? That's the responsibility of a browser's own form auto-fill. Also, this is probably in huge violation of PCI requirements... – Dai Nov 29 '21 at 23:35
  • CC-Info just putting in as a text like in my example. Im mean by autofill doing it with document.getElementById('number').value. It works on other pages but on shopify I cant reach die ID's of the input-fields (its just a little project for myself, nothing for public) – Mahal Nov 29 '21 at 23:43
  • Please provide enough code so others can better understand or reproduce the problem. – Community Dec 04 '21 at 15:35

1 Answers1

0

The problem is that the element is within an iframe. You cannot get to the element because that would be cross-site scripting. See Get element from within an iFrame for more information.

BoltKey
  • 1,994
  • 1
  • 14
  • 26