Ajax :: How To Do Basic Authentication
Mar 17, 2010How to do Basic authentication using Ajax
View 1 RepliesHow to do Basic authentication using Ajax
View 1 RepliesI'm using XHR to make some REST requests. Right now I need to handle HTTP 401 responses.When a resource is requested such as a Javascript file or CSS file the browser will popup a prompt for username and password, which is normal behaviour.When I make an XHR request for POST,GET or PUT I get an XHR response which includes a status of 401 and no popup from the browser, this is also normal.The problem is when I make a DELETE request, I get the expected XHR response AND also the browser still pops up the username and password prompt.
View 1 Replies View RelatedA client of mine is trying to integrate one of his Web systems with my system. In an essence, he wants to embed my system's web UI into his "master" web page, and display it in a sub-frame whenever a user requests my system display.My system (JBoss AS) has Basic Authentication enabled. So if a user attempts to access my system he/she is prompted to provide username/password. If correct credentials are provided, then user is allowed access to my system / web pages.Now, the client is trying to automate the login. He wants to provide the login information automatically, through JavaScript in his master page (this is needed so that users of his system don't provide any credentials - all user/pwd information is passed under the curtains).What is wrong in the approach above and do you know if there is a better way to properly implement this seamless logging (knowing that Basic Authentication is the only option)?
View 1 Replies View RelatedI am building a form where registered users will put their employment histories. Each employment history will need to be associated with an employer ID, which is in my database. Instead of having tons of page reloads as users enter each employer in their histories, I figured I'd use Ajax to do it much more quickly.
Then I realized that I wasn't sure if Ajax sent the user's cookie to the server and if it didn't, then I wouldn't be able to tell what the person's authentication status is, what they have access to (only their own records), etc.
So I would like to know if Ajax sends cookies to the server. And if not, is it possible to send the cookie to the server with the Ajax request so I can ensure that people are adding and deleting from their own profiles only?
I encounter the error message: "hasChildNodes() is not a method"
Here is my source code:
Here is the products.xml:
Why I encounter this error message?
i have a very simple ajax request, on Chrome and FF, IE 8 it works very well. IE 8 returns "error", "complete"
the content /test.php :
<div>test</div>
Ajax request:
$(document).ready(function()
{
$('#test').click(function(){
$.ajax({
[Code].....
I have been trying to find some kind of authentication method or
script (PHP/perl/javascript or other) to achieve the following, with
no luck.
Say there are 100 files at a site. A person can choose which file to
download from a list, and to do so has to enter a code or password.
When a valid code or password is used they are redirected to a page
with a direct link to download the file.
Once that code or password has been used to download that one file
(and the same code/password can be used to access any one of the 100
files), it is then expired/deleted/made invalid and can't be used
again to download any other file.
I have this following strange problem on Firefox.
When i try to request something from the HTTP server, the http server
throws a authentication dialog box, where i need to enter the username
and password.
My problem is I don't see the dialog box coming in, the moment i
request the page....sometimes it comes ....sometimes it
doesnt......and when i click on the refresh button repeatedly .... it
comes after may be 5-6 tries.... one the server side i see the
following with every request.
"[3041766304] HTTPServer::authenticate: Returning WWW-Authenticate:
Basic realm="
I also tried to set the browser.cache.check_doc_frequency parameter to
1 and 2 ....still the problem persists..
A bit of a lame request - I just don't have a lot of time to look it up. I need a script to login to a website (outside my domain) and then make a very simple web request. How do I go about doing that?
View 1 Replies View RelatedI am sending a url request to the network using jquery.get(). The problem I am facing is that the server is having an http authentication, so when i pass the request url directly on the browser, it will show the authentication window and i can pass the username and password, but what to do when i am passing the same request using get() method.
This is what i am using currently
Anybody knows a work around for this problem, which can be used for every browser. the current error code is 401..
I have to come up with a user authenication page the logs the user in and also gives them access to do the right things. I have attached the code and the access file and have got started on a few things.I first need to create a login page with the fields username and password have that check the access database and then proceed it to a page to do the following depending on the user access. For The Login button to even be enabled the username and password must have a value in it. I have no idea how to do that
Add A User [No duplicate Users]
Modify A User
Delete A User
[code]....
Ive got a really simple problem but I can't figure it out. I've got a
form named bob with one text box name bobtext with a default value of
"http://". When I add onload="document.bob.bobtext.focus()" it focuses
on the text box, but at the beginning. Is it possible to focus on the
text box, but at the end of "http://"? This seems like something easy
so I'm probably making some stupid mistake.
Suppose I have a page, call in parent.html . Inside, there is an iframe,
call it child.html . I want it so that in response to a keyboard event
in either parent or child, child.html will respond in a particular way.
Do I need to use a different set of code for each html page, or can I
reuse the same code?
If the code is different, what are the fundamental differences in code?
How do I make one frame respond to events in a different frame as a
general rule?
I know there is a million of them but here's a little calculator script I made just for kicks. Feedback is always appreciated, good or bad.
I think I did a pretty good job of mirroring the windows calculator functionality.
Basic keys are mapped (optionally) to the keyboard.
<html>
<head>
<title>Web Calculator</title>
<style type="text/css">
table
{
text-align:center;
background-color:#e5e5c5;
}
.button
{
width:55px;
font-weight:bold;
background-color:lightblue;
color:#333399;
}
.functbut
{
width:55px;
font-weight:bold;
background-color:lightblue;
color:red;
}
.back
{
width:115px;
font-weight:bold;
background-color:lightblue;
color:red;
}
.header
{
color:#333399;
}
#display
{
text-align:right;
}
</style>
<script type="text/javascript">
var find=document.getElementById;
var temp=0;
var total=0;
var which=0;
var m=0;
function Mplus()
{
m=parseFloat(find('display').value) + m;
find('memory1').value="M+*";
}
function Mclear()
{
m=0;
find('memory1').value="M+";
}
function Mrecall()
{
find('display').value=m;
}
function Mreplace()
{
m=find('display').value;
}
function showMe(num)
{
if(temp==0)
{
find('display').value=num;
temp=1;
}
else
{
find('display').value+=num;
}
}
function calcEm(num)
{
str=parseFloat(find('display').value);
if(which==0)
{
total=find('display').value;
temp=0;
which=num;
}
else if(which==1)
{
find('display').value=parseFloat(total)+ str;
total=find('display').value;
which=num;
temp=0;
}
else if(which==2)
{
find('display').value=parseFloat(total) * str;
total=find('display').value;
which=num;
temp=0;
}
else if(which==3)
{
find('display').value=parseFloat(total) / str;
total=find('display').value;
which=num;
temp=0;
}
else if(which==4)
{
find('display').value=parseFloat(total) - str;
total=find('display').value;
which=num;
temp=0;
}
}
function clearAll()
{
find('display').value=0;
which=0;
temp=0;
total=0;
}
function clearDisplay()
{
find('display').value="0"
temp=0;
}
function fractIt()
{
find('display').value=(1) / str;
}
function getPerc()
{
var d=find('display').value=str / 100;
calcEm(0);
}
function backSpace()
{
find('display').value=find('display').value.substring("0",find('display').value.length-1);
}
function getRoot()
{
find('display').value=Math.sqrt(find('display').value);
}
function invertIt()
{
var w=find('display').value.indexOf("-");
if(w==-1)
{
find('display').value="-" + find('display').value
}
else
{
find('display').value=find('display').value.substring("1",find('display').value.length);
}
}
function keyHandler()
{
keys=new Array();
keys[97]=("1");
keys[98]=("2");
keys[99]=("3");
keys[100]=("4");
keys[101]=("5");
keys[102]=("6");
keys[103]=("7");
keys[104]=("8");
keys[105]=("9");
keys[96]=("0");
keys[13]=("equal");
keys[107]=("plus");
keys[110]=("dot");
keys[109]=("minus");
keys[106]=("times");
keys[111]=("divide");
keys[110]=("dot");
keys[8]=("back");
keys[27]=("clear");
kc=window.event.keyCode;
if(keys[kc]!=undefined)
{
cColor('#333399');
setTimeout('cColor("lightblue")',100);
find(keys[kc]).click();
}
return false;
}
function cColor(bcolor)
{
find(keys[kc]).style.background=bcolor;
}
function keyOnOff()
{
var b=find('keychoice').checked
if(b==true)
{
document.onkeydown=keyHandler;
}
else
{
document.onkeydown="";
}
}
function checkHandler()
{
var e=find('keychoice').checked
if(e==false)
{
e=true;
}
else
{
e=false;
}
keyOnOff();
}
</script>
</head>
<body>
<table cellspacing="0" border="1">
<thead>
<th colspan="6" class="header">Web Calculator</th>
</thead>
<tr>
<td colspan="6"><input type="text" size="43" id="display" value="0."></td>
</tr>
<tr>
<td colspan="2"><input type="button" value="Backspace" id="back" class="back" onclick="backSpace()"></td>
<td colspan="2"><input type="button" id="ce" value="CE" class="back" onclick="clearDisplay()"></td>
<td colspan="2"><input type="button" id="clear" value="C" class="back" onclick="clearAll()"></td>
</tr>
<tr>
<td><input type="button" class="functbut" value="MC" onclick="Mclear();"></td>
<td><input type="button" class="button" id="7" value="7" onclick="showMe(ƍ')"></td>
<td><input type="button" class="button" id="8" value="8" onclick="showMe(Ǝ')"></td>
<td><input type="button" class="button" id="9" value="9" onclick="showMe(Ə')"></td>
<td><input type="button" class="functbut" id="divide" value="/" onclick="calcEm(3)"></td>
<td><input type="button" class="button" id="sqrt" value="sqrt" onclick="getRoot();"></td>
</tr>
<tr>
<td><input type="button" class="functbut" value="MR" onclick="Mrecall();"></td>
<td><input type="button" class="button" id="4" value="4" onclick="showMe(Ɗ')"></td>
<td><input type="button" class="button" id="5" value="5" onclick="showMe(Ƌ')"></td>
<td><input type="button" class="button" id="6" value="6" onclick="showMe(ƌ')"></td>
<td><input type="button" class="functbut" id="times" value="*" onclick="calcEm(2)"></td>
<td><input type="button" class="button" id="perc" value="%" onclick="getPerc()"></td>
</tr>
<tr>
<td><input type="button" class="functbut" value="MS" onclick="Mreplace();"></td>
<td><input type="button" class="button" id="1" value="1" onclick="showMe(Ƈ')"></td>
<td><input type="button" class="button" id="2" value="2" onclick="showMe(ƈ')"></td>
<td><input type="button" class="button" id="3" value="3" onclick="showMe(Ɖ')"></td>
<td><input type="button" class="functbut" id="minus" value="-" onclick="calcEm(4)"></td>
<td><input type="button" class="button" id="x" value="1/x" onclick="fractIt()"></td>
</tr>
<tr>
<td><input type="button" class="functbut" value="M+" id="memory1" onclick="Mplus();"></td>
<td><input type="button" class="button" id="0" value="0" onclick="showMe(Ɔ')"></td>
<td><input type="button" class="button" id="flop" value="+/-" onclick="invertIt()"></td>
<td><input type="button" class="button" id="dot" value="." onclick="showMe(this.value)"></td>
<td><input type="button" class="functbut" id="plus" value="+" onclick="calcEm(1)"></td>
<td><input type="button" class="functbut" id="equal" value="=" onclick="calcEm(0)"></td>
</tr>
<tr>
<td colspan="6" class="header">Num Pad On:<input type="checkbox"
id="keychoice" onclick="checkHandler();keyOnOff();"></td>
</tr>
</table>
</body>
</html>
Happy Calculating...
Does anyone know of a basic Javascript Rich Text Editor that dosen't have too many features. I don't want smily faces or the ability to insert images, only the basic text formatting. All the ones i found on google are packed full of extras i don't need.
View 1 Replies View Relatedim need to create s simple CMS/WYSIWYG, but im not a pro on js. I found one on a website, but i dont want to resort to stealing codes.
basically, theres a textarea, where you put in text, and a button for bold, italics and underline, etc. if i highlight something on the textarea and hit the bold button, the text automatically gets surrounded by the <b></b> tags, or or whatevers convinient. when i look at the inline js code from the button, it calls a function, but id rather simplify the code, it should be something like onclick=insertstyle("b","textarea_name");
I have the source code to an old BASIC program that a friend of mine
would like to run online. I am a beginner at JS, but I think that it
would be a good choice for the project. My background is in C/C++ and
web development.
Any suggestions that might get me off to a good start here? I can
provide more information if needed, but I am not sure what would be
helpful. The program is 550 lines in what appears to be BASIC and is a
calendar conversion program. You give it a date and it will convert it
into one of many other date reckoning systems (Gregorian, Hebrew,
Egyptian, etc, etc).
Here is a very basic simulated editable combo box for quick and dirty uses.
After any text input on a form you simply add a...
<script>fancycombo("[inputid]combo","[inputid]","[option1]","[option2]","[option3]")</script>
You must give the input an id as well as a name. They don't have to be the same thing, but its recommended.
NS broke when I was cleaning up the code. Searching for the error.
I have a <FORM> with several text based input controls in it, and for some reason, although I have assigned ID values to these control, when I attempt to run any JavaScript error checking on them I get JS Error messages for some reason.
To simplify where I have gone wrong, I have written a simple JS alert message as follows...
alert(document.getElementById['first_name'].value);
and the <FORM> control I have is...
<form name="paypal_send">
<input type="text" id="first_name" name="first_name2" value="hello" />
</form>
But for some reason I am getting this error message...
Error:'document.forms.paypal_send.getElementById.first_name' is null or not an object.
This is really pulling my hair out, as can be seen, the inout control has an ID??
I've been looking at all the various image replacement techniques..and they all seem unnecessarily complicated. I came up with:
function replaceLogo() {
document.getElementById('header').innerHTML = '<img src="/images/logo-tci.gif" />'
}
It's just replacing the layer contents at a very basic level.
This works just fine, I'm just wondering how well supported it would be across different browsers. Anyone know of a table of browsers that support innerHTML or see potential cross-browser issues with this technique?
How would I write this in code?
Code:
I would like to allow a user to browse his local directories, choose an
image (probably .jpeg) file, and upload it to the server (a servlet). The
same functionality that online datiing agencies use to let people save their
photograph with their profiles. (My application is an online Want Ads.)
I feel that this must be possible within a minimal client (without a JVM)
using nothing more than JavaScript, but I'll be damned if I can find how.
Would one of you more experienced JavaScript people please point me in the
right direction.
In a nutshell, I'd like to have a list of items, each of which fills out a
small table which displays some info about a particular item(the items being
a trouble ticket for a tech support ASP-built web-based app). There may be
zero, one, or many of these per ticket. Since some tickets have many of
these items (call them work items), the page can get awful long. I have this
part working already.
So my proposed solution to make the pages shorter would be to have one line
for each of these little work items. If you click the text in that one line,
it shows what had been a hidden div. If you click it again, it hides it.
See below:
Sorry I couldn't find appropriate group for
SVG and ECMAScript. Since SVG is in XML format
and ECMAScript is very similar to JavaScript.
What's why I post in these two groups.
In the O'Reilly SVG book, in chapter 11
Animating and Scripting SVG. It mentions
some very basic functions like
var circle = event.getTarget();
var obj = svgDocument.getElementById("idName");
I got error message said these are no a function
in Firefox and batik-squiggle.jar
When I used SVGView plug-in (made by Adobe) for IE .
I typed:
var svgObject = evt.target;
var svgDoc = svgObject.getOwnerDocument();
var svgElement = svgDoc.getElementById(idName);
var svgStyle = svgElement.getStyle();
svgStyle.setProperty('stroke-width', 3);
These lines are working fine for SVGViwe Plug-in by
not work for Firefox and batik.
They complained that getOwnerDocument is not a function.
I tried to change getSVGDocument but no luck.
Is that O'Reilly book too old? Its first editoin is 2002.
How can I make getElementById() working in Firefox and Batik?
Is there some examles or some documents?
I'm about to embark on really learning jQuery. The first step of which is to get a basic jquery function to work. Everytime I learn something this way the first thing does not work for no apparent reason. It's probably something obvious but I can't move on without getting this to work. I added jquery to the page I have two things a div called #content-container and an image with class .logo
[Code]....
My shopping cart is using jQuery UI 1.7.2
I added jQuery UI Datepicker 1.8.7
I'm including jquery.ui.datepicker.css and jquery.ui.all.css versions 1.8.7 in my header, when I click the input box firebug shows the datepicker code is in the source but the ui-helper-hidden-accessible class isn't being removed to display the datepicker. Do I need to update jquery or at least ui.core which is 1.7.2?
After playing with the css files I was able to get the datepicker to open but the prev and next text is being displayed above the prev/next buttons
I've tried every combination I could with these files to get a basic datepicker to open up