Hello

The liQuotes.js plugin (which replaces quotes) is connected before </ body>:

$(document).ready(function(){ jQuery.fn.liQuotes = function(options){ return this.each(function(){ htmlreplace($(this)); function htmlreplace(element){ if (!element) element = document.body; var nodes = $(element).contents().each(function () { if (this.nodeType == Node.TEXT_NODE) { var result = $(this).text().replace(/\x27/g, '\x22').replace(/(\w)\x22(\w)/g, '$1\x27$2').replace(/(^)\x22(\s)/g, '$1&raquo;$2').replace(/(^|\s|\()"/g, "$1&laquo;").replace(/"(\;|\!|\?|\:|\.|\,|$|\)|\s)/g, "&raquo;$1") $(this).after(result).remove(); } else { htmlreplace(this); }; }); }; }); }; $('.content').liQuotes(); }); $(document).ajaxStop(function() { $('.cert-bg').liQuotes(); $('.logo-space').liQuotes(); $('.search-space').liQuotes(); $('.partners-bg').liQuotes(); $('.video-blog').liQuotes(); $('.project-bg').liQuotes(); }); 

So, in all browsers, except for IE, the code works correctly (when the page loads, quotes are replaced, in the case of ajax, the query is similar - the code works in the selected elements). But in IE, the code does not work when the page loads. BUT works great with ajax request. Disabled all other js codes, swapped the startup code, changed it to onload - it does not work.

Please help - what to fix to get IE code when loading the page?

  • what IE means? - Grundy
  • What does it mean But in IE the code does not work when the page loads ? Nothing happens? writes errors in the console? doing something else? - Grundy
  • jQuery.fn.liQuotes - it's better to take out $(document).ready - why additional nesting. - Goncharov Alexander
  • IE 11. Nothing happens, unfortunately, on IE I don’t know how to check the console - I only know firebug for mozila, but everything works there. Specify, please, about "render jQuery.fn.liQuotes" - how? I just took someone else's code, I do not know how it works. I would be very grateful for any help! - Max
  • On f12, the console in ie11 also opens beautifully. Either tell me what the error is so that I can calibrate my crystal ball, or give a minimal reproducible example, with all the inclusions - Duck Learns to Take Cover

1 answer 1

The problem is the iframe . When IE gets to it and tries to get its content gets

 SCRIPT5: Access is denied. 

As a solution, you can simply check that the current element is not an iframe , and if it is an iframe , then just exit the function immediately.

For example:

 if(element.tagName == 'IFRAME') return ; 
  • It really is! Great, thank you. Please specify - how to make IE pass by this iframe? iframe is a google map - max
  • tagName , for example, you can check the tagName and if it is an IFRAME, do return . This check does not have to be done only for IE - most likely it may fall for the same reasons in other browsers, so you can simply add the line if(element.tagName == 'IFRAME') return ; - Grundy