3 Replies Latest reply on Jan 16, 2017 10:01 AM by Mylenium

    Social Sharing in Adobe Muse

    johnw17699126

      I have 3 Javascripts on my site. They are all for social media sharing. All work perfectly in Safari, Chrome and Edge.

      However Internet Explorer throws up a error on two of the three.

      The one that works on all is below.

      function fbshareCurrentPage(){window.open("https://www.facebook.com/sharer/sharer.php?u="+escape(window.location.href)+"&t="+document.title,"","menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=300,width=600")}

      This is called by a button with the link javascript:fbshareCurrentPage()

      As said the above works on all browsers that I have tested. But the Twitter and Google plus scripts does not work on IE but works on Chrome and Safari etc.

      var twitterHandle = 'HANDLE';  function tweetCurrentPage() { window.open('https://twitter.com/share?url='+escape(window.location.href)+'&text='+document.title + ' via @' + twitterHandle, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=300,width=600'); return false; }

      Called in the same way as the Facebook one.. javascript:tweetCurrentPage()

      Google Plus script is

      function john() { var w = 380; var h = 480; var x = Number((window.screen.width - w) / 2); var y = Number((window.screen.height - h) / 2); window.open("https://plus.google.com/share?url=" + encodeURIComponent(location.href) + "&title=" + encodeURIComponent(document.title), "", "width=" + w +",height=" + h + ",left=" + x + ",top=" + y +",resizable=yes" ); }

      Called by a button with the link javascript:john()

      In Chrome they all open in popup windows as I want and function correctly. In IE the google plus and twitter links open in a new tab with the below error.

      This page can’t be displayed

      •Make sure that the web address //ieframe.dll/dnserror.htm# is correct.
      •Look for the page with your search engine.

      What am I doing wrong?

      I am learning more and more about JavaScript but would appreciate some help.

      Thanks

        • 1. Re: Social Sharing in Adobe Muse
          Mylenium Most Valuable Participant

          What am I doing wrong?

          Using IE? Pardon the poking fun, but essentially that's what it comes down to. It doesn't support a bunch of JavaScript stuff and in your case you will probably need to work around the encodeURI stuff.

           

          Mylenium

          • 2. Re: Social Sharing in Adobe Muse
            johnw17699126 Level 1

            Hi Mylenium...

             

            If it was *only* internet explorer I really would not have a problem.

             

            However the problem also exists in Firefox too. What does bug me is the script for Facebook works like a charm on IE and Firefox.

            • 3. Re: Social Sharing in Adobe Muse
              Mylenium Most Valuable Participant

              Have you actually checked the debug console which URL it is actualyl fetching based on your code? Sorry, my brain is fried at the moment and I can't think straight, but I'm actually reasonably sure that your URL gets truncated in some way due to a missing quotation mark somewhere or an extraneous space. It may only work in some browsers because they correct the URLs or pipe it through a hidden Google search.

               

              Mylenium

              1 person found this helpful