Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Push Notification from Website?

  • 25-11-2011 4:03pm
    #1
    Registered Users, Registered Users 2 Posts: 705 ✭✭✭


    So I've noticed when I go onto The Journal or the Guardian on my iPhone a push notification comes up suggesting to download the app for their sites and after an hour of google searching I can't find the method of doing this.

    Anyone know a tutorial that explains how to do this? I just want to suggest making a bookmark of the site on the phone.


Comments

  • Subscribers Posts: 1,911 ✭✭✭Draco


    It's not a push notification, it's a javascript alert. It gets popped up based on the user agent - if you can figure out it's a mobile device you get it to display.


  • Registered Users, Registered Users 2 Posts: 26,584 ✭✭✭✭Creamy Goodness


    It's fairly easy I'll post a tutorial on how to do it when I get home.


  • Registered Users, Registered Users 2 Posts: 664 ✭✭✭Johnny Jukebox


    Check out Richfaces 4 for real push functionality;

    http://in.relation.to/Bloggers/GettingStartedWithRichFaces40Push


  • Registered Users, Registered Users 2 Posts: 26,584 ✭✭✭✭Creamy Goodness


    if the user agent matches an iOS UA string and cookie "seen_ios_prompt" is not set.
        <script type='text/javascript' src='js/ios_prompt.js'></script>
    else
        do nothing.
    
    var is_iPad=navigator.userAgent.match(/iPad/i) != null;
    if(is_iPad) {
        var redirect = confirm("Download our ipad app");
        var redirect_url = 'http://meathspin.com';
    }
    else {
        var redirect = confirm("Download our iphone app");
        var redirect_url = 'http://meathspin.com';
    }
    
    $.cookie("seen_ios_prompt", "1", {expires:1095});
    
    if(redirect == true) { 
        window.location = redirect_url;
    }
    

    sample assumes you have some sort of jquery included, can be done without though.

    this also taken from my head and from me fresh out of the pub so there may be errors but general gist is there.


  • Registered Users, Registered Users 2 Posts: 705 ✭✭✭keepkeyyellow


    Thank you all especially Creamy Goodness! I guess the problem was I didn't know what it was actually called, I'll have a whack at this when I get back to free wifi on college on Monday and see how it goes


  • Advertisement
Advertisement