How to suppress javascript exception?
In my application i am getting the content of some other domain's page. Along with the content it is running the javascript associated with the particular page. 开发者_开发技巧In the javascript code "document.selection.createRange()" is written which is throwing exception at run time in IE (since in IE due to security concern you can't change iframe's data or the reverse).
So my question is how to suppress the exception. Thanks in advance :)
You can do this in jQuery by using a load with a page fragment.
If .load() is called with a selector expression appended to the URL, however, the scripts are stripped out prior to the DOM being updated, and thus are not executed
Be aware though that this will only work if the other domain allows your domain access via CORS http headers.
精彩评论