Jump to the post that solved this thread.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Solved: 5 Years, 6 Months, 2 Weeks ago If url is https:// then hide?
#1
Solved: 5 Years, 6 Months, 2 Weeks ago
Im using advanced sidebox to show feeds, obviously when i go into https mode feeds dont work.

So is it possible in js to wrap the rss feed back code in a div that will check the url for http or https if its the https then it will not show the feed box.

hopefully you can understand me.

anyone?
#2
Solved: 5 Years, 6 Months, 2 Weeks ago
This is possible, yes.
if (location.protocol === 'https:') {
// Do https stuff
}
else
{
// Do other stuff
}
#3
Solved: 5 Years, 6 Months, 2 Weeks ago
(2014-09-14, 01:20 AM)nth Wrote: This is possible, yes.

if (location.protocol === 'https:') {
// Do https stuff
}
else
{
// Do other stuff
}

I tried using that but it seemed to just break this....This is the code from inside my custom template in advanced sidebox - the only place i can edit it from...

------------------------------------------

<style type="text/css"  media="all">

/* begin styles for RSS Feed */

.rss-box {
	 margin: 0em;
	 width: 147px;
	 background-color: #f5f5f5;
	 border: 0px solid silver;
	 
}
.rss-items {
	margin-top:0px;
	padding:0.5em; 0.5em;
	margin-left:0px;
	color:#000000;
}
p.rss-title {padding:0.5em;}
.rss-title {
	font-size: 8pt;
	background-color: silver;
	color: gray;
	font-weight:bold;
	text-align: left;
}

.rss-item  {
  font-size: 7pt;
  list-style:none;
  padding-bottom:1em;
}

.rss-item a {
        color: #346cbc;
	font-size: 9pt;
	font-weight:bold;
        list-style-type: square;
	}
	
.rss-item a:visited {
	color: black;
}

.rss-date {
	font-size: 7pt;
	color: #000000;
	}



</style>
<tr>
<td class="trow1">
<script language="JavaScript" src="http://feed2js.org//feed2js.php?src=http%3A%2F%2Fwww.infowars.com%2Ffeed%2F&num=13&date=y&targ=y&utf=y"  charset="UTF-8" type="text/javascript"></script>

<noscript><a href="http://feed2js.org//feed2js.php?src=http%3A%2F%2Fwww.infowars.com%2Ffeed%2F&num=13&date=y&targ=y&utf=y&html=y">View RSS feed</a></noscript>

<script language="JavaScript" src="http://feed2js.org//feed2js.php?src=http%3A%2F%2Fwww.drudgereportfeed.com%2Frss.xml&num=10&date=y&targ=y&utf=y"  charset="UTF-8" type="text/javascript"></script>

<noscript>
<a href="http://feed2js.org//feed2js.php?src=http%3A%2F%2Fwww.drudgereportfeed.com%2Frss.xml&num=10&date=y&targ=y&utf=y&html=y">View RSS feed</a>
</noscript>
</script>
</td>
</tr>




#4
Solved: 5 Years, 6 Months, 2 Weeks ago
^ do you have template conditionals plugin installed ? it is required to use conditionals in the templates
#5
Solved: 5 Years, 6 Months, 2 Weeks ago
 
Instead of hiding the boxes for people accessing over https, why not fix the problem by loading the javascript over https?

Replace every instance of http://feed2js.org//feed2js.php with https://feed2js.org/feed2js.php.
#6
Solved: 5 Years, 6 Months, 2 Weeks ago
(2014-09-14, 03:07 AM).m. Wrote: ^ do you have template conditionals plugin installed ? it is required to use conditionals in the templates

yeh im using PHP and Template Conditionals by ZiNgA BuRgA

(2014-09-14, 05:34 AM)Cameron:D Wrote:  
Instead of hiding the boxes for people accessing over https, why not fix the problem by loading the javascript over https?

Replace every instance of http://feed2js.org//feed2js.php with https://feed2js.org/feed2js.php.

Well i didnt know i could do that.....i was told on another forum that rss feeds just didnt work in https....Thanks for helping me.
#7
Solved: 5 Years, 6 Months, 2 Weeks ago
(2014-09-14, 12:02 PM)dmpops22 Wrote: Well i didnt know i could do that.....i was told on another forum that rss feeds just didnt work in https....Thanks for helping me.

Depends on the site you're embedding from, because feed2js supports https it should work fine.
#8
Solved: 5 Years, 6 Months, 2 Weeks ago
(2014-09-14, 03:07 AM).m. Wrote: ^ do you have template conditionals plugin installed ? it is required to use conditionals in the templates

You don't need that plugin for the code I posted. The code I posted was Javascript and could be used as


<script type="text/javascript">
 if (location.protocol == 'https:')
 {
   document.write("yes");
 } else {
   document.write("no")
 }</script>
Jump to the post that solved this thread.


Forum Jump:


Users browsing this thread: 1 Guest(s)