Intersection Observer API is not available










0















I developed a website with infinite Scrolling. My webpage load the content with that technology in google chrome. But When load and scrolling the webpage in Internet explore, It display an error "Intersection Observer API is not available". How to fix the issue?



Here is my code



(function ($) 
$.fn.infiniteScroll = function (options)

var observer, filesControl = 0, settings;
settings = $.extend(
files: ,
preloaderColor: "#000",
fadeDuration: 300,
beforeLoadNewContent: function () ,
processData: function(data)
var content ='<div>'+(data)+'</div>';
$('.' + settings.markSelector).before(content);
$(content).fadeTo(settings.fadeDuration, 1);
,
afterLoadNewContent: function () ,
onEnd: function ()
, options);
settings.markSelector;

infiniteContentLoader = function (entry)
if (entry[0].isIntersecting && !$(".infiniteContentPreloader").is(":visible") && filesControl < settings.files.length)
$(".infiniteContentPreloader").toggle();
$.ajax(
type: "GET",
url:settings.files[filesControl],
dataType: "html",
success:function (data)
settings.beforeLoadNewContent();
$(".infiniteContentPreloader").toggle();
settings.processData(data);
filesControl++;
settings.afterLoadNewContent();

);
else if(entry[0].isIntersecting && !$(".infiniteContentPreloader").is(":visible") && filesControl >= settings.files.length)
observer.disconnect();
settings.onEnd();



infiniteScroll = function (element)
settings.markSelector = "infiniteContentMark_" + Date.now();
var mark = '<div class="' + (settings.markSelector) + '" style="width:100%;"></div>';
$(element).append(mark);

$(document).ready(function ()
$('.' + settings.markSelector).html('<div class="infiniteContentPreloader" style="width: 150px; height: 150px; margin: 0 auto; display: none;"><svg version="1.1" id="L4" xmlns="http://www.w3.org/2000/svg" xmlns: xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 100 100" enable-background="new 0 0 0 0" xml: space="preserve"><circle fill="'+ (settings.preloaderColor) + '" strok="none" cx="6" cy="50" r="6"><animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.1"></animate></circle><circle fill="'+ (settings.preloaderColor) + '" stroke="none" cx="26" cy="50" r="6"><animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.2"></animate></circle><circle fill="'+ (settings.preloaderColor) + '" stroke="none" cx="46" cy="50" r="6"><animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.3"></animate></circle></svg></div>');

if (!('IntersectionObserver' in window))
console.log("Intersection Observer API is not available");
else
var options =
root: null,
rootMargin: '0px',
threshold: 0

observer = new IntersectionObserver(infiniteContentLoader, options);
var infiniteContentMark = $('.' + settings.markSelector).toArray()[0];
observer.observe(infiniteContentMark);

);


if (this.length > 0)
return infiniteScroll(this);

;
)(window.jQuery || window.Zepto || window.$);









share|improve this question


























    0















    I developed a website with infinite Scrolling. My webpage load the content with that technology in google chrome. But When load and scrolling the webpage in Internet explore, It display an error "Intersection Observer API is not available". How to fix the issue?



    Here is my code



    (function ($) 
    $.fn.infiniteScroll = function (options)

    var observer, filesControl = 0, settings;
    settings = $.extend(
    files: ,
    preloaderColor: "#000",
    fadeDuration: 300,
    beforeLoadNewContent: function () ,
    processData: function(data)
    var content ='<div>'+(data)+'</div>';
    $('.' + settings.markSelector).before(content);
    $(content).fadeTo(settings.fadeDuration, 1);
    ,
    afterLoadNewContent: function () ,
    onEnd: function ()
    , options);
    settings.markSelector;

    infiniteContentLoader = function (entry)
    if (entry[0].isIntersecting && !$(".infiniteContentPreloader").is(":visible") && filesControl < settings.files.length)
    $(".infiniteContentPreloader").toggle();
    $.ajax(
    type: "GET",
    url:settings.files[filesControl],
    dataType: "html",
    success:function (data)
    settings.beforeLoadNewContent();
    $(".infiniteContentPreloader").toggle();
    settings.processData(data);
    filesControl++;
    settings.afterLoadNewContent();

    );
    else if(entry[0].isIntersecting && !$(".infiniteContentPreloader").is(":visible") && filesControl >= settings.files.length)
    observer.disconnect();
    settings.onEnd();



    infiniteScroll = function (element)
    settings.markSelector = "infiniteContentMark_" + Date.now();
    var mark = '<div class="' + (settings.markSelector) + '" style="width:100%;"></div>';
    $(element).append(mark);

    $(document).ready(function ()
    $('.' + settings.markSelector).html('<div class="infiniteContentPreloader" style="width: 150px; height: 150px; margin: 0 auto; display: none;"><svg version="1.1" id="L4" xmlns="http://www.w3.org/2000/svg" xmlns: xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 100 100" enable-background="new 0 0 0 0" xml: space="preserve"><circle fill="'+ (settings.preloaderColor) + '" strok="none" cx="6" cy="50" r="6"><animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.1"></animate></circle><circle fill="'+ (settings.preloaderColor) + '" stroke="none" cx="26" cy="50" r="6"><animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.2"></animate></circle><circle fill="'+ (settings.preloaderColor) + '" stroke="none" cx="46" cy="50" r="6"><animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.3"></animate></circle></svg></div>');

    if (!('IntersectionObserver' in window))
    console.log("Intersection Observer API is not available");
    else
    var options =
    root: null,
    rootMargin: '0px',
    threshold: 0

    observer = new IntersectionObserver(infiniteContentLoader, options);
    var infiniteContentMark = $('.' + settings.markSelector).toArray()[0];
    observer.observe(infiniteContentMark);

    );


    if (this.length > 0)
    return infiniteScroll(this);

    ;
    )(window.jQuery || window.Zepto || window.$);









    share|improve this question
























      0












      0








      0








      I developed a website with infinite Scrolling. My webpage load the content with that technology in google chrome. But When load and scrolling the webpage in Internet explore, It display an error "Intersection Observer API is not available". How to fix the issue?



      Here is my code



      (function ($) 
      $.fn.infiniteScroll = function (options)

      var observer, filesControl = 0, settings;
      settings = $.extend(
      files: ,
      preloaderColor: "#000",
      fadeDuration: 300,
      beforeLoadNewContent: function () ,
      processData: function(data)
      var content ='<div>'+(data)+'</div>';
      $('.' + settings.markSelector).before(content);
      $(content).fadeTo(settings.fadeDuration, 1);
      ,
      afterLoadNewContent: function () ,
      onEnd: function ()
      , options);
      settings.markSelector;

      infiniteContentLoader = function (entry)
      if (entry[0].isIntersecting && !$(".infiniteContentPreloader").is(":visible") && filesControl < settings.files.length)
      $(".infiniteContentPreloader").toggle();
      $.ajax(
      type: "GET",
      url:settings.files[filesControl],
      dataType: "html",
      success:function (data)
      settings.beforeLoadNewContent();
      $(".infiniteContentPreloader").toggle();
      settings.processData(data);
      filesControl++;
      settings.afterLoadNewContent();

      );
      else if(entry[0].isIntersecting && !$(".infiniteContentPreloader").is(":visible") && filesControl >= settings.files.length)
      observer.disconnect();
      settings.onEnd();



      infiniteScroll = function (element)
      settings.markSelector = "infiniteContentMark_" + Date.now();
      var mark = '<div class="' + (settings.markSelector) + '" style="width:100%;"></div>';
      $(element).append(mark);

      $(document).ready(function ()
      $('.' + settings.markSelector).html('<div class="infiniteContentPreloader" style="width: 150px; height: 150px; margin: 0 auto; display: none;"><svg version="1.1" id="L4" xmlns="http://www.w3.org/2000/svg" xmlns: xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 100 100" enable-background="new 0 0 0 0" xml: space="preserve"><circle fill="'+ (settings.preloaderColor) + '" strok="none" cx="6" cy="50" r="6"><animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.1"></animate></circle><circle fill="'+ (settings.preloaderColor) + '" stroke="none" cx="26" cy="50" r="6"><animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.2"></animate></circle><circle fill="'+ (settings.preloaderColor) + '" stroke="none" cx="46" cy="50" r="6"><animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.3"></animate></circle></svg></div>');

      if (!('IntersectionObserver' in window))
      console.log("Intersection Observer API is not available");
      else
      var options =
      root: null,
      rootMargin: '0px',
      threshold: 0

      observer = new IntersectionObserver(infiniteContentLoader, options);
      var infiniteContentMark = $('.' + settings.markSelector).toArray()[0];
      observer.observe(infiniteContentMark);

      );


      if (this.length > 0)
      return infiniteScroll(this);

      ;
      )(window.jQuery || window.Zepto || window.$);









      share|improve this question














      I developed a website with infinite Scrolling. My webpage load the content with that technology in google chrome. But When load and scrolling the webpage in Internet explore, It display an error "Intersection Observer API is not available". How to fix the issue?



      Here is my code



      (function ($) 
      $.fn.infiniteScroll = function (options)

      var observer, filesControl = 0, settings;
      settings = $.extend(
      files: ,
      preloaderColor: "#000",
      fadeDuration: 300,
      beforeLoadNewContent: function () ,
      processData: function(data)
      var content ='<div>'+(data)+'</div>';
      $('.' + settings.markSelector).before(content);
      $(content).fadeTo(settings.fadeDuration, 1);
      ,
      afterLoadNewContent: function () ,
      onEnd: function ()
      , options);
      settings.markSelector;

      infiniteContentLoader = function (entry)
      if (entry[0].isIntersecting && !$(".infiniteContentPreloader").is(":visible") && filesControl < settings.files.length)
      $(".infiniteContentPreloader").toggle();
      $.ajax(
      type: "GET",
      url:settings.files[filesControl],
      dataType: "html",
      success:function (data)
      settings.beforeLoadNewContent();
      $(".infiniteContentPreloader").toggle();
      settings.processData(data);
      filesControl++;
      settings.afterLoadNewContent();

      );
      else if(entry[0].isIntersecting && !$(".infiniteContentPreloader").is(":visible") && filesControl >= settings.files.length)
      observer.disconnect();
      settings.onEnd();



      infiniteScroll = function (element)
      settings.markSelector = "infiniteContentMark_" + Date.now();
      var mark = '<div class="' + (settings.markSelector) + '" style="width:100%;"></div>';
      $(element).append(mark);

      $(document).ready(function ()
      $('.' + settings.markSelector).html('<div class="infiniteContentPreloader" style="width: 150px; height: 150px; margin: 0 auto; display: none;"><svg version="1.1" id="L4" xmlns="http://www.w3.org/2000/svg" xmlns: xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 100 100" enable-background="new 0 0 0 0" xml: space="preserve"><circle fill="'+ (settings.preloaderColor) + '" strok="none" cx="6" cy="50" r="6"><animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.1"></animate></circle><circle fill="'+ (settings.preloaderColor) + '" stroke="none" cx="26" cy="50" r="6"><animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.2"></animate></circle><circle fill="'+ (settings.preloaderColor) + '" stroke="none" cx="46" cy="50" r="6"><animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.3"></animate></circle></svg></div>');

      if (!('IntersectionObserver' in window))
      console.log("Intersection Observer API is not available");
      else
      var options =
      root: null,
      rootMargin: '0px',
      threshold: 0

      observer = new IntersectionObserver(infiniteContentLoader, options);
      var infiniteContentMark = $('.' + settings.markSelector).toArray()[0];
      observer.observe(infiniteContentMark);

      );


      if (this.length > 0)
      return infiniteScroll(this);

      ;
      )(window.jQuery || window.Zepto || window.$);






      jquery






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 14 '18 at 7:14









      User2893User2893

      447




      447






















          3 Answers
          3






          active

          oldest

          votes


















          1














          Internet Explorer doesn't support Intersection Observer.



          Luckily W3C provides a polyfill that you can use. https://github.com/w3c/IntersectionObserver/tree/master/polyfill



          With this you can continue to use the Intersection Observer as usual and older browsers will instead use events bound to the scroll event (not as performant as native Intersection Observer)






          share|improve this answer






























            1















            But When load and scrolling the webpage in Internet explore




            The reason seams to be simple to find, but probably difficult to fix:



             if (!('IntersectionObserver' in window)) 
            console.log("Intersection Observer API is not available");



            Means that the browser does not support the IntersectionObserver. In other words: the code will most likely only work in the browsers listed here



            As mentioned in the answer of @cloned, it should be easy to fix, if you include the polyfill.






            share|improve this answer
































              0














              I'd recommend using the polyfill.io service. If you include the following code in your page:



              <script src="https://polyfill.io/v2/polyfill.min.js?features=IntersectionObserver"></script>


              It will automatically ship the required polyfill based on the browser. So if a user is on Chrome which doesn't need the polyfill it won't even ship those bytes to the browser.






              share|improve this answer






















                Your Answer






                StackExchange.ifUsing("editor", function ()
                StackExchange.using("externalEditor", function ()
                StackExchange.using("snippets", function ()
                StackExchange.snippets.init();
                );
                );
                , "code-snippets");

                StackExchange.ready(function()
                var channelOptions =
                tags: "".split(" "),
                id: "1"
                ;
                initTagRenderer("".split(" "), "".split(" "), channelOptions);

                StackExchange.using("externalEditor", function()
                // Have to fire editor after snippets, if snippets enabled
                if (StackExchange.settings.snippets.snippetsEnabled)
                StackExchange.using("snippets", function()
                createEditor();
                );

                else
                createEditor();

                );

                function createEditor()
                StackExchange.prepareEditor(
                heartbeatType: 'answer',
                autoActivateHeartbeat: false,
                convertImagesToLinks: true,
                noModals: true,
                showLowRepImageUploadWarning: true,
                reputationToPostImages: 10,
                bindNavPrevention: true,
                postfix: "",
                imageUploader:
                brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                allowUrls: true
                ,
                onDemand: true,
                discardSelector: ".discard-answer"
                ,immediatelyShowMarkdownHelp:true
                );



                );













                draft saved

                draft discarded


















                StackExchange.ready(
                function ()
                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53294892%2fintersection-observer-api-is-not-available%23new-answer', 'question_page');

                );

                Post as a guest















                Required, but never shown

























                3 Answers
                3






                active

                oldest

                votes








                3 Answers
                3






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes









                1














                Internet Explorer doesn't support Intersection Observer.



                Luckily W3C provides a polyfill that you can use. https://github.com/w3c/IntersectionObserver/tree/master/polyfill



                With this you can continue to use the Intersection Observer as usual and older browsers will instead use events bound to the scroll event (not as performant as native Intersection Observer)






                share|improve this answer



























                  1














                  Internet Explorer doesn't support Intersection Observer.



                  Luckily W3C provides a polyfill that you can use. https://github.com/w3c/IntersectionObserver/tree/master/polyfill



                  With this you can continue to use the Intersection Observer as usual and older browsers will instead use events bound to the scroll event (not as performant as native Intersection Observer)






                  share|improve this answer

























                    1












                    1








                    1







                    Internet Explorer doesn't support Intersection Observer.



                    Luckily W3C provides a polyfill that you can use. https://github.com/w3c/IntersectionObserver/tree/master/polyfill



                    With this you can continue to use the Intersection Observer as usual and older browsers will instead use events bound to the scroll event (not as performant as native Intersection Observer)






                    share|improve this answer













                    Internet Explorer doesn't support Intersection Observer.



                    Luckily W3C provides a polyfill that you can use. https://github.com/w3c/IntersectionObserver/tree/master/polyfill



                    With this you can continue to use the Intersection Observer as usual and older browsers will instead use events bound to the scroll event (not as performant as native Intersection Observer)







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Nov 14 '18 at 7:21









                    clonedcloned

                    64957




                    64957























                        1















                        But When load and scrolling the webpage in Internet explore




                        The reason seams to be simple to find, but probably difficult to fix:



                         if (!('IntersectionObserver' in window)) 
                        console.log("Intersection Observer API is not available");



                        Means that the browser does not support the IntersectionObserver. In other words: the code will most likely only work in the browsers listed here



                        As mentioned in the answer of @cloned, it should be easy to fix, if you include the polyfill.






                        share|improve this answer





























                          1















                          But When load and scrolling the webpage in Internet explore




                          The reason seams to be simple to find, but probably difficult to fix:



                           if (!('IntersectionObserver' in window)) 
                          console.log("Intersection Observer API is not available");



                          Means that the browser does not support the IntersectionObserver. In other words: the code will most likely only work in the browsers listed here



                          As mentioned in the answer of @cloned, it should be easy to fix, if you include the polyfill.






                          share|improve this answer



























                            1












                            1








                            1








                            But When load and scrolling the webpage in Internet explore




                            The reason seams to be simple to find, but probably difficult to fix:



                             if (!('IntersectionObserver' in window)) 
                            console.log("Intersection Observer API is not available");



                            Means that the browser does not support the IntersectionObserver. In other words: the code will most likely only work in the browsers listed here



                            As mentioned in the answer of @cloned, it should be easy to fix, if you include the polyfill.






                            share|improve this answer
















                            But When load and scrolling the webpage in Internet explore




                            The reason seams to be simple to find, but probably difficult to fix:



                             if (!('IntersectionObserver' in window)) 
                            console.log("Intersection Observer API is not available");



                            Means that the browser does not support the IntersectionObserver. In other words: the code will most likely only work in the browsers listed here



                            As mentioned in the answer of @cloned, it should be easy to fix, if you include the polyfill.







                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Nov 14 '18 at 7:24

























                            answered Nov 14 '18 at 7:18









                            philippphilipp

                            8,75653570




                            8,75653570





















                                0














                                I'd recommend using the polyfill.io service. If you include the following code in your page:



                                <script src="https://polyfill.io/v2/polyfill.min.js?features=IntersectionObserver"></script>


                                It will automatically ship the required polyfill based on the browser. So if a user is on Chrome which doesn't need the polyfill it won't even ship those bytes to the browser.






                                share|improve this answer



























                                  0














                                  I'd recommend using the polyfill.io service. If you include the following code in your page:



                                  <script src="https://polyfill.io/v2/polyfill.min.js?features=IntersectionObserver"></script>


                                  It will automatically ship the required polyfill based on the browser. So if a user is on Chrome which doesn't need the polyfill it won't even ship those bytes to the browser.






                                  share|improve this answer

























                                    0












                                    0








                                    0







                                    I'd recommend using the polyfill.io service. If you include the following code in your page:



                                    <script src="https://polyfill.io/v2/polyfill.min.js?features=IntersectionObserver"></script>


                                    It will automatically ship the required polyfill based on the browser. So if a user is on Chrome which doesn't need the polyfill it won't even ship those bytes to the browser.






                                    share|improve this answer













                                    I'd recommend using the polyfill.io service. If you include the following code in your page:



                                    <script src="https://polyfill.io/v2/polyfill.min.js?features=IntersectionObserver"></script>


                                    It will automatically ship the required polyfill based on the browser. So if a user is on Chrome which doesn't need the polyfill it won't even ship those bytes to the browser.







                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered Jan 8 at 7:51









                                    Leon RevillLeon Revill

                                    1,15011222




                                    1,15011222



























                                        draft saved

                                        draft discarded
















































                                        Thanks for contributing an answer to Stack Overflow!


                                        • Please be sure to answer the question. Provide details and share your research!

                                        But avoid


                                        • Asking for help, clarification, or responding to other answers.

                                        • Making statements based on opinion; back them up with references or personal experience.

                                        To learn more, see our tips on writing great answers.




                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function ()
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53294892%2fintersection-observer-api-is-not-available%23new-answer', 'question_page');

                                        );

                                        Post as a guest















                                        Required, but never shown





















































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown

































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown







                                        這個網誌中的熱門文章

                                        Barbados

                                        How to read a connectionString WITH PROVIDER in .NET Core?

                                        Node.js Script on GitHub Pages or Amazon S3