Modify link on generated HTML

I have created the following JSfiddle to show you what I want to do.

It should be self-explanatory from that.
I want to reiterate that this is generated from an external 3rd party code that is intended to be embedded on your website, that I have no access to, so I cannot edit the original source and change it.

I need to programmatically modify the URL of that “increase score” button that is displayed after someone has submitted the form and the result has been generated.
This is beyond my own JS skills, but I’m sure some clever clogs here can tell me how to do it.

document.querySelector(".mt-3").href = ""

As the ‘Increase Score’ button is within an iframe, I doubt this will work.

I question whether what is being attempted is legal.


Yes indeed it won’t; you’d have to access theYes content document of the iframe, which is only possible if it has the same origin as the parent page.


oh right. S’what i get for answering a post right before going to bed lol. I didnt even notice the iframe and the console defaulted to being in the context necessary when right clicked and inspected.

You’d be able to do it in that way (manually, or probably with something like Tampermonkey running on your browser). Doing it from the page itself however will run into the cross-origin issues mentioned.

1 Like

You’re not sure if it’s legal? Wtf
It’s changing some html on a page on my own website, not hacking into a bank :rofl:

I hadn’t noticed it was creating an iframe myself actually. Bum.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.