James
James

Reputation: 2834

How to set focus on an iframe that is cross-domain

Similar to the posts below:

  1. Set focus on iframe in Chrome

  2. Setting focus to iframe contents

From the root/parent I want to be able to pass focus to the iframe.

Anything that may be in focus in the iframe is fine.

iframe.contentWindow.focus();

However, the iframe.contentWindow is not accessible because its a cross-origin frame.

Upvotes: 1

Views: 1070

Answers (1)

James
James

Reputation: 2834

Seems like the answer is: not possible.

If there is a script running in the iframe you can directly call focus from there.

Upvotes: 1

Related Questions