Software Archive
Read-only legacy content
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
17060 Discussions

jquery button to link to an external window

Waldo_Y_
Beginner
660 Views

Hi all,

I'm very new to scripting and coding so I might not get through to you guys but I hope this attempt goes straight to the point so I don't bore you. 

So I've been searching online for an example javascript  like the window.open and noticed this. https://software.intel.com/en-us/node/493021. How do you make it work to where you click on a button on a IOS app to natively open Safari to the preferred website. Can anyone show me a link or post an example so that I can try it?

 

0 Kudos
3 Replies
Waldo_Y_
Beginner
660 Views

Hey all I figured it out I'll just leave the coding for those who wish to find it for their own as well.

 

<script id="xdkJSonDeviceReady_">
      function onDeviceReady() {                                          // ignored by "Standard HTML5 web app"
            if( navigator.splashscreen && navigator.splashscreen.hide ) {   // Cordova hide splashscreen detected, use it
                navigator.splashscreen.hide() ;
            }
            
        }
        document.addEventListener("deviceready", onDeviceReady, false) ;    // ignored by "Standard HTML5 web app"
        
        $(document).ready(function() {
            $("#facebook").bind("click", function() {
                intel.xdk.device.showRemoteSiteExt("http://www.facebook.com/merailrabeluu");
            });
        });
    </script>
    <script id="xdkJSonDeviceReady_">
      function onDeviceReady() {                                          // ignored by "Standard HTML5 web app"
            if( navigator.splashscreen && navigator.splashscreen.hide ) {   // Cordova hide splashscreen detected, use it
                navigator.splashscreen.hide() ;
            }
            
        }
        document.addEventListener("deviceready", onDeviceReady, false) ;    // ignored by "Standard HTML5 web app"
        
        $(document).ready(function() {
            $("#twitter").bind("click", function() {
                intel.xdk.device.showRemoteSiteExt("http://www.twitter.com/merailrabeluu");
            });
        });
    </script>
0 Kudos
Samuel_G_1
Beginner
660 Views

Much easier to read....and works just as well: 

    <script id="xdkJSonDeviceReady_">
      function onDeviceReady() {                                          // ignored by "Standard HTML5 web app"
            if( navigator.splashscreen && navigator.splashscreen.hide ) {   // Cordova hide splashscreen detected, use it
                navigator.splashscreen.hide() ;
            }
        }
        document.addEventListener("deviceready", onDeviceReady, false) ;    // ignored by "Standard HTML5 web app"
         
        $(document).ready(function() {
            $("#facebook").bind("click", function() {
                intel.xdk.device.showRemoteSiteExt("http://www.facebook.com/merailrabeluu");
            });
            $("#twitter").bind("click", function() {
                intel.xdk.device.showRemoteSiteExt("http://www.twitter.com/merailrabeluu");
            });
        });
    </script>

 

0 Kudos
Waldo_Y_
Beginner
660 Views

Thanks Samuel G.,

I appreciate the code. Sorry I'm not really code savvy. It's really a self taught experience for me. I read the code and  I see what you did there. Very interesting. Thanks for your help. I will update it to my file.

 

0 Kudos
Reply