I have a page containing an iframe in the center of the page and its cross domain iframe. When the page is loaded focus of the page is shifted to center of page containing iframe. I am trying to ensure focus is shifted to top of the page. Below solution works only in IE but not in chrome/Firefox.
Input control 'foo' is present at top portion of the page. Any idea? why it doesnt work I think chrome has problem with blur property.
<iframe width="1200" height="380" id="usageReport" src="https://google.com" frameborder="0" allowfullscreen="true"></iframe>
<script language="javascript" type="text/javascript">
window.onload = function() {
$('#foo').on('blur',function () {
var blurEl = $(this);
setTimeout(function() {
blurEl.focus()
}, 10);
});
};
</script>