admin管理员组文章数量:1314496
I can't figure out where I am going wrong with this. In other browsers, it works fine:
function main__pageeditor_new_body_SetUrl()
{
function getUrlParam(parentObject, paramName)
{
var reParam = new RegExp('(?:[\?&]|&)' + paramName + '=([^&]+)', 'i') ;
var match = parentObject.location.search.match(reParam) ;
return (match && match.length > 1) ? match[1] : '' ;
}
var funcNum = getUrlParam(this, 'CKEditorFuncNum');
this.opener.CKEDITOR.tools.callFunction(funcNum, arguments[0]);
}
But in IE you get this error:
'this.opener.CKEDITOR' is null or not an object
Why wouldn't this work?
I can't figure out where I am going wrong with this. In other browsers, it works fine:
function main__pageeditor_new_body_SetUrl()
{
function getUrlParam(parentObject, paramName)
{
var reParam = new RegExp('(?:[\?&]|&)' + paramName + '=([^&]+)', 'i') ;
var match = parentObject.location.search.match(reParam) ;
return (match && match.length > 1) ? match[1] : '' ;
}
var funcNum = getUrlParam(this, 'CKEditorFuncNum');
this.opener.CKEDITOR.tools.callFunction(funcNum, arguments[0]);
}
But in IE you get this error:
'this.opener.CKEDITOR' is null or not an object
Why wouldn't this work?
Share Improve this question edited Jul 4, 2012 at 11:00 Simon McLoughlin 8,4755 gold badges34 silver badges62 bronze badges asked Jul 4, 2012 at 10:58 andyandy 2,4093 gold badges32 silver badges51 bronze badges 1- 1 There must be some javascript missing from your example. Does something assign window.opener to this.opener? – dsas Commented Jul 4, 2012 at 11:16
7 Answers
Reset to default 1For anyone wondering - This helped quite a bit:
http://docs.cksource./CKEditor_3.x/Developers_Guide/File_Browser_(Uploader)/Custom_File_Browser
window.opener doesn't always work in IE8 for security reasons. I think you can put the site(s) in the "trusted zone" so that it will allow window.opener to work.
If the two windows are in different domains then it won't work in any browser due to the same origin policy.
please test once that what is NULL ??
this.opener
or
this.opener.CKEDITOR
window.opener works when my security zone is 'Internet' in IE8. Tried on Window Opener
Next, I wanted to try this on CKEDITOR itself so I went to CKEDITOR DEMO
There I opened a popup 'window.open' using Developer Toolbar and in the popup, I executed following code which worked fine.
>>String(this.opener.CKEDITOR.tools.callFunction);
Response
"function(f){var g=e[f];return g&&g.apply(window,Array.prototype.slice.call(arguments,1));}"
At this point when everything works for me, I would request you to upload your code.
I found this with a simple search: http://social.msdn.microsoft./Forums/en-US/iewebdevelopment/thread/0c014e78-8d35-4df3-93da-7f6a30b4ed8b/
The solution provided there is:
Under the Security Tab in your internet options, click on the Trusted Websites Icon. Now check the checkbox marked "Enable Protected Mode" and restart internet explorer.
Another resource I found suggests to also remove the site from the trusted zone:
remove the site from Trusted sites list... it is probably already mapped to the same security zone as the opener (intranet). Select the File>Properties dialog in IE to determine which security zone a page/domain is mapped to.
Given that you've probably tried several suggestions so far, you might have changed enough settings to be in a weird configuration state. I'd suggest you reset all your zone settings to the default and start from scratch.
I have faced Issue window.opener getting null in my Web application running in http:/localhost:8080.If I placed the IP address/hostname instead of localhost then this issue doesn't occurred.
Lets check, I strongly believe this solution is helpful.
Your "this" context could be getting changed, depending on how you use the function.
change:
this.opener.CKEDITOR.tools.callFunction(funcNum, arguments[0]);
to:
window.opener.CKEDITOR.tools.callFunction(funcNum, arguments[0]);
Does that fix it?
本文标签: javascriptWindowopener undefined in IE8Stack Overflow
版权声明:本文标题:javascript - Window.opener undefined in IE8? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741968380a2407685.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论