Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

include or display if not ssl/https/secure

Featured Replies

I have a pices of informatyion / javascript for the cookie control code on my site which i DO NOT want to display if the page is a secure/SSL/https page.

 

can anyone help me with the a php if statment please

  • Author

thinking maybe something like

 

<?php

if ($request_type == 'NONSSL') {

//code goes here for non-ssl

} else {

//if its ssl, show me this stuff

}

?>

  • Author

or even

 

<?php // If page is SSL then use Secure Code

if($_SERVER['HTTPS']=='on'){

 

//Put your secure code here

 

} else { // Else use Non-Secure Code

 

// Put your non-secure code here.

 

} // End if

?>

if(empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == 'off') {
   // CODE HERE FOR NON SSL
} else {
   // CODE HERE FOR SSL
}

  • Author

all thats seems to happen is i get a blank site,

 

im using this in the footer of my site to include a civicuk cookie control script

 

<?php

if(empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == 'off') {
    // CODE HERE FOR NON SSL
<script src="https://ssl.geoplugin.net/javascript.gp" type="text/javascript"></script>
<script src="cookieControl-5.1.min.js" type="text/javascript"></script>
<script type="text/javascript">//<![CDATA[
 cookieControl({
  introText:'<p>This site uses some unobtrusive cookies to store information on your computer.</p>',
  fullText:'<p>This site uses some unobtrusive cookies.</p>',
  position:'left', // left or right
  shape:'triangle', // triangle or diamond
  theme:'dark', // light or dark
  startOpen:true,
  autoHide:6000,
  subdomains:true,
  protectedCookies: [], //list the cookies you do not want deleted ['analytics', 'twitter']
  consentModel:'implicit',
  onAccept:function(){ccAddAnalytics()},
  onReady:function(){},
  onCookiesAllowed:function(){ccAddAnalytics()},
  onCookiesNotAllowed:function(){},
  countries:'United Kingdom,Netherlands' // Or supply a list ['United Kingdom', 'Greece']
  });

  function ccAddAnalytics() {
    jQuery.getScript("https://www.google-analytics.com/ga.js", function() {
	  var GATracker = _gat._createTracker('');
	  GATracker._trackPageview();
    });
  }
  //]]>
</script>  
} else {
    // CODE HERE FOR SSL
}

?>

all thats seems to happen is i get a blank site,

 

im using this in the footer of my site to include a civicuk cookie control script

 

<?php

if(empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == 'off') {
 // CODE HERE FOR NON SSL
<script src="https://ssl.geoplugin.net/javascript.gp" type="text/javascript"></script>
<script src="cookieControl-5.1.min.js" type="text/javascript"></script>
<script type="text/javascript">//<![CDATA[
cookieControl({
 introText:'<p>This site uses some unobtrusive cookies to store information on your computer.</p>',
 fullText:'<p>This site uses some unobtrusive cookies.</p>',
 position:'left', // left or right
 shape:'triangle', // triangle or diamond
 theme:'dark', // light or dark
 startOpen:true,
 autoHide:6000,
 subdomains:true,
 protectedCookies: [], //list the cookies you do not want deleted ['analytics', 'twitter']
 consentModel:'implicit',
 onAccept:function(){ccAddAnalytics()},
 onReady:function(){},
 onCookiesAllowed:function(){ccAddAnalytics()},
 onCookiesNotAllowed:function(){},
 countries:'United Kingdom,Netherlands' // Or supply a list ['United Kingdom', 'Greece']
 });

 function ccAddAnalytics() {
 jQuery.getScript("https://www.google-analytics.com/ga.js", function() {
	 var GATracker = _gat._createTracker('');
	 GATracker._trackPageview();
 });
 }
//]]>
</script>
} else {
 // CODE HERE FOR SSL
}

?>

Maybe cause you're not actually echoing anything?

 

Rather than using 'echo' I like to do something like this.

 

<?php

if(empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == 'off') { ?>
 // CODE HERE FOR NON SSL
<script src="https://ssl.geoplugin.net/javascript.gp" type="text/javascript"></script>
<script src="cookieControl-5.1.min.js" type="text/javascript"></script>
<script type="text/javascript">//<![CDATA[
cookieControl({
 introText:'<p>This site uses some unobtrusive cookies to store information on your computer.</p>',
 fullText:'<p>This site uses some unobtrusive cookies.</p>',
 position:'left', // left or right
 shape:'triangle', // triangle or diamond
 theme:'dark', // light or dark
 startOpen:true,
 autoHide:6000,
 subdomains:true,
 protectedCookies: [], //list the cookies you do not want deleted ['analytics', 'twitter']
 consentModel:'implicit',
 onAccept:function(){ccAddAnalytics()},
 onReady:function(){},
 onCookiesAllowed:function(){ccAddAnalytics()},
 onCookiesNotAllowed:function(){},
 countries:'United Kingdom,Netherlands' // Or supply a list ['United Kingdom', 'Greece']
 });

 function ccAddAnalytics() {
 jQuery.getScript("https://www.google-analytics.com/ga.js", function() {
	 var GATracker = _gat._createTracker('');
	 GATracker._trackPageview();
 });
 }
//]]>
</script>
<?php } else {
 // CODE HERE FOR SSL
}

?>

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.