473,385 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

JavaScript function for secure page

I am writing some JavaScript code and need to write one set of code if on a standard page and a different set if on a secure page.
Does anyone know if there is a JavaScript function that tests for this?
Thanks,

Don

Jul 23 '05 #1
4 1442
John wrote:
I am writing some JavaScript code and need to write one set of code if
on a standard page and a different set if on a secure page.

Does anyone know if there is a JavaScript function that tests for this?

Thanks,

Don

secure= (location.protocol=="https")
if(secure){ do stuff;}
if(!secure){ do stuff;}

Mick
Jul 23 '05 #2
Mick White wrote:
secure= (location.protocol=="https")
if(secure){ do stuff;}
if(!secure){ do stuff;}


Would not

if (location.protocol.toLowerCase() == "https")
{
do_stuff();
}
else
{
do_other_stuff();
}

be better?
PointedEars
--
"This is a light sabre" - "I've never heard it called _that_ before"
Jul 23 '05 #3
Thomas 'PointedEars' Lahn wrote:
Mick White wrote:

secure= (location.protocol=="https")
if(secure){ do stuff;}
if(!secure){ do stuff;}

Would not

if (location.protocol.toLowerCase() == "https")
{
do_stuff();
}
else
{
do_other_stuff();
}

be better?


Yes and no.
Mick

Jul 23 '05 #4
Mick White wrote:
Thomas 'PointedEars' Lahn wrote:
Mick White wrote:
secure= (location.protocol=="https")
if(secure){ do stuff;}
if(!secure){ do stuff;}

Would not

if (location.protocol.toLowerCase() == "https")
{
do_stuff();
}
else
{
do_other_stuff();
}

be better?


Yes and no.


Care to be more specific?
PointedEars
--
No one can accuse you of looking at dirty pictures when you're using Lynx.
Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

41
by: Mr. x | last post by:
Hello, Can I make my java script code be invisible to other people who enter into my site by IE browser ? - How ? Thanks :)
1
by: Philip Herlihy | last post by:
I get more JS errors than I'd expect, on a wide range of sites. (It's possible I only know this because the Debug is set on). I found an error on a Microsoft site, and decided to investigate. I...
3
by: Plamen Valtchev | last post by:
This is my problem: From JavaScript I want to find the list of all defined/loaded JavaScript functions/objects/names within the current scope (html page in a browser). the page could contain...
6
by: Tony G. | last post by:
Hi there, I have an APS 3 application, running on a Windows 2003 Web edition server - it is a very busy website, and when users are click on certain links (membership info), a new window i...
5
by: Connie Walsh | last post by:
Hi: I gleaned a javascript off of the web: http://www.hypergurl.com/popup.html that sets a cookie everytime someone visits your site. If it is the first visit in x number of days then a...
2
by: techfuzz | last post by:
I scoured this group and others looking for the best way to disable a button after the first click to prevent multiple submissions, but never did find anything that worked like they said it would. ...
1
by: CR1 | last post by:
I found a great cookie script below, but don't know how to make it also pass the values sent to the cookie, to a querystring as well for tracking purposes. Can anyone help? If there was a way to...
8
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How can I protect a webpage in javascript?...
3
by: krg | last post by:
Hi, I started writing this blog some time back and it would be great if I could get an audience here and even better if we could have a conversation about developments possible on the techniques I...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.