Search Engine Optimization Forum - SEO Refugee  

Go Back   Search Engine Optimization Forum - SEO Refugee > Business and Commerce > Web Design and Coding

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-04-2006, 10:59 AM
pittbug's Avatar
Google denies I'm #1
 
Join Date: Nov 2005
Location: Columbus, OH
Posts: 1,539
pittbug OH MY GOD!pittbug OH MY GOD!pittbug OH MY GOD!pittbug OH MY GOD!pittbug OH MY GOD!pittbug OH MY GOD!
pittbug OH MY GOD!pittbug OH MY GOD!pittbug OH MY GOD!pittbug OH MY GOD!pittbug OH MY GOD!pittbug OH MY GOD!pittbug OH MY GOD!pittbug OH MY GOD!pittbug OH MY GOD!pittbug OH MY GOD!
help wanted: detecting http and https in javascript

I would like to implement this pseudo code in javascript, can anyone give me a hand please?


if url is secure then
document.write secure-something
else
document.write non-secure something
end if

Thanks
__________________
Find your company listing on Manta.com and claim it for free - upload a logo, add detailed info, contact info and (seo friendly) links
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 12-04-2006, 11:13 AM
Wit's Avatar
Wit Wit is offline
 
Join Date: Nov 2005
Location: Dordrecht NL
Posts: 4,799
Wit SEOR GuruWit SEOR GuruWit SEOR GuruWit SEOR GuruWit SEOR Guru
Wit SEOR GuruWit SEOR GuruWit SEOR GuruWit SEOR GuruWit SEOR GuruWit SEOR GuruWit SEOR GuruWit SEOR GuruWit SEOR GuruWit SEOR Guru
Send a message via Skype™ to Wit
if (location.protocol=='https:') yadayada ?????

You may have to do a substr() thingie, cuz I dunno if the location.protocol string EQUALS or CONTAINS https......
__________________
Hey, DIY your SEO and smile!... Gotta love my host (no kidding) ... Take the flu quiz now
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 12-04-2006, 11:18 AM
eKstreme's Avatar
Chief Google Lover... NOT
 
Join Date: Feb 2006
Location: Bed, probably.
Posts: 2,020
eKstreme OH MY GOD!eKstreme OH MY GOD!eKstreme OH MY GOD!eKstreme OH MY GOD!
eKstreme OH MY GOD!eKstreme OH MY GOD!eKstreme OH MY GOD!eKstreme OH MY GOD!eKstreme OH MY GOD!eKstreme OH MY GOD!eKstreme OH MY GOD!eKstreme OH MY GOD!eKstreme OH MY GOD!eKstreme OH MY GOD!eKstreme OH MY GOD!eKstreme OH MY GOD!eKstreme OH MY GOD!eKstreme OH MY GOD!eKstreme OH MY GOD!
You're too quick Wit! This code, I think, will do it nicely:
Code:
var loc = document.location.href;
if(loc.indexOf("http")>-1){
document.write('Insecure');
}
if(loc.indexOf("https")>-1){
document.write('Secure');
}
Pierre
__________________
eKstreme.com - Are your keywords buzzing?
Blog of science - learn something new today!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 12-04-2006, 11:45 AM
pittbug's Avatar
Google denies I'm #1
 
Join Date: Nov 2005
Location: Columbus, OH
Posts: 1,539
pittbug OH MY GOD!pittbug OH MY GOD!pittbug OH MY GOD!pittbug OH MY GOD!pittbug OH MY GOD!pittbug OH MY GOD!
pittbug OH MY GOD!pittbug OH MY GOD!pittbug OH MY GOD!pittbug OH MY GOD!pittbug OH MY GOD!pittbug OH MY GOD!pittbug OH MY GOD!pittbug OH MY GOD!pittbug OH MY GOD!pittbug OH MY GOD!
Thanks for your help guys. I was using it to display the google analytics tracking code which was stored in a global footer include file. The problem is that it would show secure errors when going into https. I don't want to use 2 footer files, so this seems like the best answer:

Code:
<script type="text/javascript">
	document.write( '<scr'+'ipt type="text/javascript" src="' );
	if( document.location.toString().indexOf( 'https://' ) != -1 ) {
		document.write( 'https://ssl' );
	} else {
		document.write( 'http://www' );
	}
	document.write( '.google-analytics.com/urchin.js"><\/scr'+'ipt>' );
</script>

<script type="text/javascript">
_uacct = "UA-XXXXXX-X";
urchinTracker();
</script>
__________________
Find your company listing on Manta.com and claim it for free - upload a logo, add detailed info, contact info and (seo friendly) links
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

  Search Engine Optimization Forum - SEO Refugee > Business and Commerce > Web Design and Coding

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -8. The time now is 10:02 AM. - Contact Us - SEOrefugee.com - a Search Engine Optimization Forum - Top

Powered by vBulletin®
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO Refugee