Reputation: 11
I have a scenario where one form leads to another and the second one is inside an iFrame. I wanted to figure out how to pass string data onto the form within the iFrame. I've tried a few JavaScript codes I found online but none are working
Upvotes: 1
Views: 249
Reputation: 327
You cannot view/modify within an iframe. Even if you set CORS most browsers block a lot of functionality today. if you have control of both sites you can use post messages.
Upvotes: 1
Reputation: 66
if your iframe's id is 'if', this will give you the inner doc
var innerDoc = document.getElementById("if").contentDocument;
then you can find your element from there.
Upvotes: 0