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.

External .CGI File .js Problem

Featured Replies

My site contains a lot of scripts used to display rss feeds all of which use the following js file,

so I copied it from its original source to my server to make things more efficient, which works fine, however when I tried the same with the cgi file (red) it didn't work and my rss feeds do not display.

 

I just uploaded the cgi to my server and the changed th red url to match it, is there something I've missed?

 

http://feed.mikle.com/js/rssmikle.js

(function(){
var a = window;
a.rssmikle_frame_width = a.rssmikle_frame_width ? a.rssmikle_frame_width : 180;
a.rssmikle_frame_height = a.rssmikle_frame_height ? a.rssmikle_frame_height : 500;
a.rssmikle_item_description_tag = a.rssmikle_item_description_tag ? a.rssmikle_item_description_tag : '';
var url = '[color=#ff0000]http://feed.mikle.com/feeds/rssmikle.cgi[/color]'
+ '?rssmikle_url=' + (a.rssmikle_url ? encodeURIComponent(a.rssmikle_url) : '')
+ '&rssmikle_type=' + (a.rssmikle_type ? a.rssmikle_type : '')
+ '&rssmikle_frame_width=' + a.rssmikle_frame_width
+ '&rssmikle_frame_height=' + a.rssmikle_frame_height
+ '&rssmikle_frame_rico=' + (a.rssmikle_frame_rico ? a.rssmikle_frame_rico : '')
+ '&rssmikle_target=' + (a.rssmikle_target ? a.rssmikle_target : '')
+ '&rssmikle_font=' + (a.rssmikle_font ? a.rssmikle_font : '')
+ '&rssmikle_font_size=' + (a.rssmikle_font_size ? a.rssmikle_font_size : '')
+ '&rssmikle_border=' + (a.rssmikle_border ? a.rssmikle_border : '')
+ '&rssmikle_css_url=' + (a.rssmikle_css_url ? encodeURIComponent(a.rssmikle_css_url) : '')
+ '&rssmikle_title=' + (a.rssmikle_title ? a.rssmikle_title : '')
+ '&rssmikle_title_bgcolor=' + (a.rssmikle_title_bgcolor ? encodeURIComponent(a.rssmikle_title_bgcolor) : '')
+ '&rssmikle_title_color=' + (a.rssmikle_title_color ? encodeURIComponent(a.rssmikle_title_color) : '')
+ '&rssmikle_title_bgimage=' + (a.rssmikle_title_bgimage ? encodeURIComponent(a.rssmikle_title_bgimage) : '')
+ '&rssmikle_item_bgcolor=' + (a.rssmikle_item_bgcolor ? encodeURIComponent(a.rssmikle_item_bgcolor) : '')
+ '&rssmikle_item_bgimage=' + (a.rssmikle_item_bgimage ? encodeURIComponent(a.rssmikle_item_bgimage) : '')
+ '&rssmikle_item_title_length=' + (a.rssmikle_item_title_length ? a.rssmikle_item_title_length : '')
+ '&rssmikle_item_title_color=' + (a.rssmikle_item_title_color ? encodeURIComponent(a.rssmikle_item_title_color) : '')
+ '&rssmikle_item_border_bottom=' + (a.rssmikle_item_border_bottom ? a.rssmikle_item_border_bottom : '')
+ '&rssmikle_item_description=' + (a.rssmikle_item_description ? a.rssmikle_item_description : '')
+ '&rssmikle_item_description_length=' + (a.rssmikle_item_description_length ? a.rssmikle_item_description_length : '')
+ '&rssmikle_item_description_color=' + (a.rssmikle_item_description_color ? encodeURIComponent(a.rssmikle_item_description_color) : '')
+ '&rssmikle_item_description_tag=' + (a.rssmikle_item_description_tag ? a.rssmikle_item_description_tag : '')
+ '&rssmikle_item_date=' + (a.rssmikle_item_date ? a.rssmikle_item_date : '')
+ '&rssmikle_item_podcast=' + (a.rssmikle_item_podcast ? a.rssmikle_item_podcast : '');
// + '&rssmikle_ref=' + encodeURIComponent(document.URL);
if(a.rssmikle_border != 'off' && !a.rssmikle_css_url){
a.rssmikle_frame_width = parseInt(a.rssmikle_frame_width) + 2;
a.rssmikle_frame_height = parseInt(a.rssmikle_frame_height) + 2;
}
var scroll_flag = 'no';
if (a.rssmikle_item_description_tag == 'on_scrollbar'){
scroll_flag = 'auto';
}
document.write('<iframe name="rssmikle_frame" width="' + a.rssmikle_frame_width + '" height="' + a.rssmikle_frame_height + '" frameborder="0" src="' + url + '" marginwidth="0" marginheight="0" vspace="0" hspace="0" scrolling="' + scroll_flag + '"></iframe>');
a.rssmikle_url = '';
a.rssmikle_type = '';
a.rssmikle_frame_width = '';
a.rssmikle_frame_height = '';
a.rssmikle_frame_rico = '';
a.rssmikle_target = '';
a.rssmikle_font = '';
a.rssmikle_font_size = '';
a.rssmikle_border = '';
a.rssmikle_css_url = '';
a.rssmikle_title = '';
a.rssmikle_title_bgcolor = '';
a.rssmikle_title_color = '';
a.rssmikle_title_bgimage = '';
a.rssmikle_item_bgcolor = '';
a.rssmikle_item_bgimage = '';
a.rssmikle_item_title_length = '';
a.rssmikle_item_title_color = '';
a.rssmikle_item_border_bottom = '';
a.rssmikle_item_description = '';
a.rssmikle_item_description_length = '';
a.rssmikle_item_description_color = '';
a.rssmikle_item_description_tag = '';
a.rssmikle_item_date = '';
a.rssmikle_item_podcast = '';
})()

 

Heres the cgi source

http://feed.mikle.com/feeds/rssmikle.cgi

 <html>
 <head>
 <title>Error</title>
 </head>
 <body>
 <center><font color=red size=1>Could not access <!-- 0 --></font></center>
 </body></html>

 <html>
 <head>
 <title>Error</title>
 </head>
 <body>
 <center><font color=red size=1>Sorry, could not print RSS</font></center>
 </body></html>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
		  <style type='text/css'>
		  body{margin:0;padding:0;overflow-x:hidden;}
		  #container{overflow:hidden;margin:0;padding:0;width:180px;height:500px;font-family:;font-size:12px;border:1px solid #CCCCCC;}
		  #header{margin:0px;padding:5px 5px 5px 5px;color:#FFFFFF;background-color:#0066FF;background-image:none;}
		  #header .feed_title{margin:0;padding:0;font-weight:bold;}
		  #header .feed_title a:link{color:#FFFFFF;text-decoration:none;}
		  #header .feed_title a:visited{color:#FFFFFF;text-decoration:none;}
		  #header .feed_title a:hover{color:#FFFFFF;text-decoration:underline;}
		  #header .feed_title a:active{color:#FFFFFF;text-decoration:none;}
		  #content{margin:0px;padding:5px 0px 0px 0px;background-color:#FFFFFF;background-image:none;}
		  #content .feed_item{margin:0 0 7px 0;padding:0 0 7px 0;border-bottom:1px dashed #CCCCCC;}
		  #content .feed_item_title{margin:1px 0 1px 3px;padding:1px 2px 1px 3px;color:#666666;font-weight:bold;}
		  #content .feed_item_title a:link{color:#666666;text-decoration:none;}
		  #content .feed_item_title a:visited{color:#666666;text-decoration:none;}
		  #content .feed_item_title a:hover{color:#666666;text-decoration:underline;}
		  #content .feed_item_title a:active{color:#666666;text-decoration:none;}
		  #content .feed_item_podcast{margin:0 0 0 3px;padding:0 0 0 3px;}
		  #content .feed_item_date{margin:0 0 0 3px;padding:0 2px 0 3px;color:#666666;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;}
		  #content .feed_item_description{margin:0 0 0 3px;padding:0 2px 0 3px;color:#666666;line-height:135%;}
		  #footer{display:none;height:0px;margin:0px;padding:0px;color:#FFFFFF;background-color:#FFFFFF;background-image:none;}
		  </style>

<script type='text/javascript'>
<!--
function getObjectHeight(obj) {
 var result = 0;
 if(obj.offsetHeight){
   result = obj.offsetHeight;
 } else if (obj.clip && obj.clip.height){
   result = obj.clip.height;
 } else if (obj.style && obj.style.pixelHeight) {
   result = obj.style.pixelHeight;
 }
 return strToInt(result);
}
function getElementStyle(obj,IEStyleProp,CSSStyleProp) {
 if(obj.currentStyle){
   return obj.currentStyle[iEStyleProp];
 } else if (window.getComputedStyle) {
   return window.getComputedStyle(obj,'').getPropertyValue(CSSStyleProp);
 } else if (document.defaultView.getComputedStyle) {
   return document.defaultView.getComputedStyle(obj,'').getPropertyValue(CSSStyleProp);
 }
 return '';
}
function getPlayerTag(url) {
 var playerWidth = 150;
 var playerHeightMovie = 120;
 var playerHeightSound = 45;
 var playerHeight = playerHeightMovie;
 var fileExtension = url.replace(/^.*\./,'');
 var tag;
 if(fileExtension == 'mp3' || fileExtension == 'asf' || fileExtension == 'wma' || fileExtension == 'wav' || fileExtension == 'aiff' || fileExtension == 'mpg' || fileExtension == 'mpeg' || fileExtension == 'avi'){
   if(fileExtension == 'mp3' || fileExtension == 'wav'){
  playerHeight = playerHeightSound;
   }
   tag = '<OBJECT CLASSID="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" '
  + 'WIDTH="' + playerWidth + '" '
  + 'HEIGHT="' + playerHeight + '" '
  + 'ALIGN="middle" '
  + 'STANDBY="Loading Microsoft Windows Media Player components..." '
  + 'CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112" '
  + 'TYPE="application/x-oleobject">'
  + '<PARAM NAME="AutoStart" VALUE="false">'
  + '<PARAM NAME="FileName" VALUE="' + url + '">'
  + '<PARAM NAME="ShowControls" VALUE="true">'
  + '<PARAM NAME="ShowStatusBar" VALUE="false">'
  + '<EMBED WIDTH="' + playerWidth + '" HEIGHT="' + playerHeight + '" SRC="' + url + '" '
  + 'ALIGN="middle" AUTOSTART="0" SHOWCONTROLS="1 SHOWSTATUSBAR="0" TYPE="application/x-mplayer2" PLUGINSPAGE="http://www.microsoft.com/Windows/MediaPlayer/" />'
  + '</OBJECT>';
 } else if(fileExtension == 'qt' || fileExtension == 'mov'){
   tag = '<OBJECT CLASSID="CLSID:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" '
  + 'WIDTH="' + playerWidth + '" '
  + 'HEIGHT="' + playerHeight + '" '
  + 'ALIGN="middle" '
  + 'STANDBY="Loading QuickTime Player components..." ENABLEJavascript="true" TYPE="video/quicktime" '
  + 'CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab">'
  + '<PARAM NAME="AutoPlay" VALUE="false">'
  + '<PARAM NAME="Src" VALUE="',url,'">'
  + '<PARAM NAME="Controller" VALUE="true">'
  + '<EMBED WIDTH="' + playerWidth + '" HEIGHT="' + playerHeight + '" SRC="' + url + '" '
  + 'ALIGN="middle" AUTOPLAY="false" CONTROLLER="true" TYPE="video/quicktime" ENABLEJavascript="true" '
  + 'PLUGINSPAGE="http://www.apple.com/quicktime/download/" />'
  + '</OBJECT>';
 } else if(fileExtension == 'rm'){
   tag = '<OBJECT CLASSID="CLSID:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" '
  + 'WIDTH="' + playerWidth + '" '
  + 'HEIGHT="' + playerHeight + '" '
  + 'ALIGN="middle">'
  + '<PARAM NAME="AutoStart" VALUE="false">'
  + '<PARAM NAME="Src" VALUE="' + url + '">'
  + '<PARAM NAME="Console" VALUE="oneyhkplayerdiv9">'
  + '<PARAM NAME="Controls" VALUE="imagewindow">'
  + '<EMBED WIDTH="' + playerWidth + '" '
  + 'HEIGHT="' + playerHeight + '" '
  + 'ALIGN="middle" AUTOSTART="false" CONTROLS="imagewindow" CONSOLE="oneyhkplayerdiv9" SRC="' + url + '" '
  + 'TYPE="audio/x-pn-realaudio-plugin" PLUGINSPAGE="http://www.real.com/" />'
  + '</OBJECT>';
 } else if(fileExtension == 'swf'){
   tag = '<OBJECT CLASSID="CLSID:D27CDB6E-AE6D-11CF-96B8-444553540000" '
  + 'WIDTH="' + playerWidth + '" '
  + 'HEIGHT="' + playerHeight + '" '
  + 'ALIGN="middle" TYPE="application/x-oleobject">'
  + '<PARAM NAME="MOVIE" VALUE="' + url + '">'
  + '<PARAM NAME="SWLIVECONNECT" VALUE="true">'
  + '<PARAM NAME="PLAY" VALUE="false">'
  + '<PARAM NAME="LOOP" VALUE="false">'
  + '<PARAM NAME="MENU" VALUE="false">'
  + '<PARAM NAME="QUALITY" VALUE="high">'
  + '<PARAM NAME="BGCOLOR" VALUE="#FFFFFF">'
  + '<PARAM NAME="FLASHVARS" VALUE="">'
  + '<PARAM NAME="SCALE" VALUE="default">'
  + '<PARAM NAME="WMODE" VALUE="window">'
  + '<PARAM NAME="ALLOWSCRIPTACCESS" VALUE="sameDomain">'
  + '<EMBED WIDTH="' + playerWidth + '" HEIGHT="' + playerHeight + '" ALIGN="middle" TYPE="application/x-shockwave-flash" '
  + 'SRC="' + url + '" SWLIVECONNECT="true" PLAY="false" LOOP="false" '
  + 'MENU="false" QUALITY="high" BGCOLOR="#FFFFFF" FLASHVARS="" SCALE="default" WMODE="window" ALLOWSCRIPTACCESS="sameDomain" '
  + 'PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" /></OBJECT>';
 } else {
   if(url.indexOf('youtube')){
  var pos1 = url.indexOf('v=') + 2;
  var pos2 = url.indexOf('&', pos2);
  var youtube_url = 'http://www.youtube.com/embed/' + url.substring(pos1, pos2);
  tag = '<IFRAME '
    + 'WIDTH="' + playerWidth + '" '
    + 'HEIGHT="' + playerHeight + '" '
    + 'SRC="' + youtube_url + '" '
    + 'FRAMEBORDER="0" allowfullscreen> '
    + '</IFRAME>';
   }
 }
 return tag;
}
function strToInt(str) {
 num = parseInt(str);
 if(isNaN(num)){
   return 0;
 } else if(!num) {
   return 0;
 }
   return num;
}
function init() {
 var rssMikleType = '';
 var anchorTarget = '_blank';
 var itemPodcast = 'icon';
 var containerObj = document.getElementById('container');
 var headerObj = document.getElementById('header') ? document.getElementById('header') : "";
 var contentObj = document.getElementById('content');
 var footerObj = document.getElementById('footer');
 var totalHeight = getObjectHeight(containerObj);
 var headerHeight = headerObj ? getObjectHeight(headerObj) + strToInt(getElementStyle(headerObj,'marginTop','margin-top')) + strToInt(getElementStyle(headerObj,'marginBottom','margin-bottom')) : 0;
 var contentMargin = strToInt(getElementStyle(contentObj,'marginTop','margin-top')) + strToInt(getElementStyle(contentObj,'marginBottom','margin-bottom'))
 var contentPadding = strToInt(getElementStyle(contentObj,'paddingTop','padding-top')) + strToInt(getElementStyle(contentObj,'paddingBottom','padding-bottom'));
 var footerHeight = getObjectHeight(footerObj) + strToInt(getElementStyle(footerObj,'marginTop','margin-top')) + strToInt(getElementStyle(footerObj,'marginBottom','margin-bottom'));
 var contentHeight = totalHeight - headerHeight - contentMargin - footerHeight;
 var tmpHeight = contentHeight - contentPadding;
 if(rssMikleType == 'ticker'){
   var spanElem = document.getElementsByTagName('span');
   for(var i=0; i < spanElem.length; i++){
  if(spanElem[i].className == 'feed_item_title'){
  } else if(spanElem[i].className == 'feed_item_podcast') {
    spanElem[i].innerHTML = "";
  } else if(spanElem[i].className == 'feed_item_description') {
    spanElem[i].innerHTML = spanElem[i].innerHTML.replace(/<.*?>/g,'');
  }
   }
 } else {
   var divElem = document.getElementsByTagName('div');
   var noneFlag = 0;
   var itemCounter = 1;
   for(var i=0; i < divElem.length; i++){
  if(divElem[i].className == 'feed_item'){
    if(!noneFlag){
	  for(var j=0; j < divElem[i].childNodes.length; j++) {
	    if(divElem[i].childNodes[j].className == 'feed_item_title'){
	    } else if(divElem[i].childNodes[j].className == 'feed_item_podcast') {
		  if(itemPodcast == 'player'){
		    divElem[i].childNodes[j].innerHTML = getPlayerTag(divElem[i].childNodes[j].childNodes[0].href) ? getPlayerTag(divElem[i].childNodes[j].childNodes[0].href) : divElem[i].childNodes[j].innerHTML;
		  }
	    }
	  }
	  var tmpObjHeight = getObjectHeight(divElem[i]);
	  var tmpMarginTop = strToInt(getElementStyle(divElem[i],'marginTop','margin-top'));
	  var tmpMarginBottom = strToInt(getElementStyle(divElem[i],'marginBottom','margin-bottom'));
	  tmpHeight -= tmpObjHeight - tmpMarginTop;
	  if(tmpHeight < 0 && itemCounter != 1){
	    if (Array['rssmikle_item_description_tag'] != 'on_scrollbar') {
		  divElem[i].style.display = 'none';
		  noneFlag = 1;
	    }
	  }
	  tmpHeight -= tmpMarginBottom;
    } else {
	  divElem[i].style.display = 'none';
    }
    itemCounter++;
  }
   }
   contentObj.style.height = contentHeight + 'px';
 }
 var aElem = document.getElementsByTagName('a');
 for(var i=0; i < aElem.length; i++){
   aElem[i].target = anchorTarget;
 }
}

    window.onload = init;
    -->
    </script>
    </head>
    <body>
    <div id="container"><div id="header"><div class="feed_title"></div></div>
<div id="content">
</div><div id="footer"></div></div>		  <script type="text/javascript">
	  var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
	  document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
	  </script>
	  <script type="text/javascript">
	  try {
	  var pageTracker = _gat._getTracker("UA-199268-12");
	  pageTracker._trackPageview("/feeds/rssmikle.cgi");
	  } catch(err) {}</script></body></html>

  • Author

Do I even need this CGI file, is there anyway I can cut it out?

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.