Javascript not working on PS3 Browser

2019-08-02 20:31发布

问题:

I have recently put an advertising box that overlays the embedded videos on my website. Users are forced to click the "CLOSE TO PLAY" button in order to close the advertisement overlay and play the video.

See it in action here: http://www.animefushigi.com/ao-no-exorcist-17/4

The problem: I have been getting complaints from PS3 users that the Close to Play button is not working on the PS3 browser, thus they are stuck with the ad overlay.

The button's javascript is as follows:

    $(document).ready(function(){
      $(".btn").click(function() {
        $(this).closest(".olBlock").toggleClass("display");
      });
    }); 

Any suggestions on how to fix this?

回答1:

The problem is, in the PS3 Browser (NetFront 3.1), the Flash plugin (video player) receives the Click event, instead of the HTML overlay.

Therefore, the only solution is to have a close clickable element outside the bounds of the Flash object, such as moving the "Close to play" psuedo button just after the video player. For aesthetics, you may prefer to leave the close button where it is & add the typical "[x]" close element in the top right corner, positioning this just above the Flash player.

If you need to test for the PS3 browser (may not be necessary, if you include the "[x]" element for all browsers), the user agent string includes "PLAYSTATION 3", so you could test for it on the client as follows:

var isPs3Browser = (navigator.userAgent.indexOf("PLAYSTATION 3") >= 0);

As far as I can tell, the jQuery.browser object can not be used to check for the PS3 browser, especially as the object may be deprecated.