I have an html file which intends to load XHR html files. Here is my code:
<div id='some-id'></div>
<div id='some-id-2'></div>
<script type='text/javascript'>
$('#some-id').load('some-url');
</script>
My problem is the external html file contains some javascript code which is executed after embedding it. How can I prevent this problem? (The url is cross-domain and I do not have permission to the remote domain server)
some-urlhave a single top-level element? If that's the case, you can specify a selector matching that element after the URL andload()will strip the scripts.