Handling JavaScript Across 2 Domains

Jan 9, 2003

I am working on this web site with some of the pages at a different domain name. It is actually one web site, but some of the pages are at a different domain name (different root, too) although the IP address is the same.

Basically, there is one main window, and a pop-up window. They need to "talk" to each other - mainly access properties to see what page they are on.

As, the web site is on two domain names, there is a security problem when the pop-up window tries to read properties in the main window, or vice versa.

Is there anyway to share information between the two? Or is it hopeless?

View 1 Replies


ADVERTISEMENT

Communicating Via Javascript Across Domains

Jul 20, 2005

- two websites, one on domain1 and the other on domain2
- domain1 opens a new window which is a javascript app from domain2
- domain1 needs to communicate with the javascript app on domain2

The problem occurs in that last step. Browsers don't allow script access
across domains for security reasons, rightly so. Nonetheless, I still
need to communicate with the application. I can reload the window
passing the necessary commands through the url, but this is slow because
the whole javascript app must reload.

Anyone have any ideas about a way around this limitation that would be
semi-efficient, at least more efficient than reloading the app? Signing
the script isn't an option for cost reasons. I have control over both
sites, so I can do anything that needs to be done.

View 13 Replies View Related

Javascript Event Handling And Page Load

Nov 13, 2007

I understand that when loading a page, the html parser is suspended until any script that it comes across is executed. i also believe that certain browsers will allow user input for those parts rendered whilst the rest of the page is still being parsed. suppose that a user clicks a button that is visible and 'active' and fires off some lengthy javascript execution causing the ui to 'freeze' for a while. my question is, on a page that is still being parsed but allows user input on those parts parsed and rendered, will the parsing of the rest of the page cease whilst the event handler (onclick) is working or will the user see the page render simultaneously as the event handler does its job?

View 7 Replies View Related

Parsing Xml Across Domains?

Jun 22, 2011

I'm trying to work with XML DOM for the first time as I need to grab a value from a SOAP request. I've been following this: [URL], which says modern browsers won't parse xml files from another server for security reasons. How would I got about doing this then? I've been using the price of crude oil as an example [URL] and want code portable enough to put on something like Tumblr, so I don't think I can actually save the file locally first.

View 13 Replies View Related

JQuery :: Ajax Across Domains?

Aug 25, 2011

I am wanting to make an ajax call across domains. Im attempting to call an external api with json data and (hopefully) receive a response. It's a mapquest api to obtain driving routes.Is there a mechanism in jQuery that will allow me to make a cross-domain ajax call?

View 12 Replies View Related

Validate Email Field To Reject Certain Domains?

Jan 18, 2010

here is my current email validation code:

function validateEmail(strValue) {
var objRegExp = /(^[a-z]([a-z_.]*)@([a-z_.]*)([.][a-z]{3})$)|(^[a-z]([a-z_.]*)@([a-z_.]*)(.[a-z]{3})(.[a-z]{2})*$)/i;
return objRegExp.test(strValue);
}

what should i add to reject email addresses from hotmail.com and yahoo.com?

View 1 Replies View Related

Traffic Analytics Script Where Add The Same Code To All Domains?

Jan 29, 2010

With Google Analytics, you have to create a new profile for each domain, and post different code on each domain.

I'd like a traffic stats script (or website) where you can just add the same code for any domain, and that domain will be automatically tracked, even if it's a new domain. So if I have 100 domains and then add the same code to the 101st domain, it will track that domain fine.

Doesn't matter if the script needs to be hosted on your own server, or if it's 3rd party like Google Analytics. It can be commercial too if it's got an unlimited domain license. Anyone know of something like this?

View 3 Replies View Related

Google Maps & Mutiple Domains But One Site.

Jul 30, 2006

I have a site that uses 2 domains to forward to the IP no. (a .org.uk and .co.uk). The site uses the Google Map API for a map on the site, however the API key is locked to the individual domain (I do have two keys for both the domains). I found the following Javascript which is supposed to switch the key depending on the domain that is accessing the page.

Code:

if (window.location.host == 'www.domain1.com') {
document.write('<'+'script
src="http://maps.google.com/maps?file=api&v=1&key=key/for/domain1"
type="text/javascript">' +
'<'+'/script>');
} else if (window.location.host == 'www.domain2.com') {
document.write('<'+'script
src="http://maps.google.com/maps?file=api&v=1&key=key/for/domain2"
type="text/javascript">' +
'<'+'/script>');
} else {
alert("host ="+window.location.host);
}

but I can't get it to work, the page doesn't display any map (not even an alert) if I use this instead of the normal API key script.

View 4 Replies View Related

Validate Email Field To Reject Specific Domains

Jan 18, 2010

here is my current email validation code:

function validateEmail(strValue) {

var objRegExp = /(^[a-z]([a-z_.]*)@([a-z_.]*)([.][a-z]{3})$)|(^[a-z]([a-z_.]*)@([a-z_.]*)(.[a-z]{3})(.[a-z]{2})*$)/i;

return objRegExp.test(strValue);

}

what should i add to reject email addresses from hotmail.com and yahoo.com?

View 5 Replies View Related

Frame Handling

Jul 23, 2005

I'm looking for tutorials or articles considering HTML Frames and how to
handle them with Javascript.

E.g. samples how Frames can exchange information, can a Frame instruct
other Frame to update it's content etc.

View 5 Replies View Related

Date Handling

Oct 25, 2005

We have some date fields in our HTML forms in various places. In the
accounts package we use, there is some pretty nifty date handling.

It has a standardised date format of dd/mm/yyyy and if you enter e.g.

3-12 it will switch it to 3/12/2005

Same applies for e.g. 3:12 etc

Anyone know of some javascript which will do this for our HTML form
fields? Our target format is actually dd-mon-yyyy and it would make it
really nice for users if the system could accept a variety of input
formats and then switch it to a date to our specification. Any
suggestions?

View 8 Replies View Related

Handling Onblur

Feb 16, 2006

I have few textfields and dropdowns in my jsp, form is submitted on
clicking an image link.

In case there is an error for instance some text field is left empty,
then message is displayed below respective fields ( using spans, inner
html). The message is displayed onblur event of the field. So if there
was an error then message is displayed, now if the user corrects the
error and clicks the link then first the message disaapears ,which is
desired ,but he has to click again to submit the form. please suggest a
way to handle this. So that user doesn't have to click the link twice
to submit the form.I tried having onmousedown and onfocus events on
image , but then sometimes the form was submitted twice which gave
backend errors.

View 2 Replies View Related

Using The Key Handling Function

Jul 20, 2005

I have a piece of simple code which take the user inputs and depending which check box is selected directs them to a different page.

<form name="allform">
<input type="radio" name="allsearch" value="Weaksearch">
<font face="Arial,Helvetica" >Weak&nbsp;</font><br>
<input type="radio" name="allsearch" value="Pinsersearch">

<font face="Arial,Helvetica" >Pinser&nbsp;</font><br>
<input type="radio" name="allsearch" value="Brutesearch">
<font face="Arial,Helvetica">Brute note&nbsp;</font> <br>
<input type="radio" name="allsearch" checked
value="gogsearch">
<font face="Arial,Helvetica">Google</font> <br>
<input type=text name=allsearchtext size=10 maxlength=255>

<input type="button" onClick="locateall(this)" value="Go"
name="button">
</form>

This works but the user needs to hit the go button, if they just hit return the text field is emptied, I would like if the user hits ENTER, the search begins.

I believe I can add something similar as

if (window.event.keyCode == 13)

But I am not sure how to incorporate it in the form?

View 3 Replies View Related

Input Character Set Handling

Nov 10, 2006

I am struggling to find definitive information on how IE 5.5, 6 and 7
handle character input (I am happy with the display of text).

I have two main questions:

1. Does IE automaticall convert text input in HTML forms from the
native character set (e.g. SJIS, 8859-1 etc) to UTF-8 prior to sending
the input back to the server?

2. Does IE Javascript do the same? So if I write a Javascript function
that compares a UTF-8 string to a string that a user has inputted into
a text box, will IE convert the user's string into UTF-8 before doing
the comparison?

I think that the answer to question 1 is probably "YES", but I cannot
find any information on question 2!

View 44 Replies View Related

JQuery :: 1.4.2 Events Handling And IE6?

Aug 2, 2010

Geeting a JS error from IE 6 only in this method: handle: function( event ) { var all, handlers, namespaces, namespace, events;

[Code]...

On the last line of the code snippet above. It appears to me that IE6 doesn't like the fact that the events object is undefined. To trigger this error we are doing a simple blur binding to an input box. ex:

$(field).bind('blur', function(){onfocusout(this);}); It appears IE 6 stops executing JS after the error (imagine that). Is this an issue in jQuery core or BTW I know MS has dropped IE 6 support but we still have customers.

View 2 Replies View Related

Handling Maths In Strange Way?

Aug 25, 2010

I have javascript calculating the total price of all the products in a shoppping cart. The prices are in the format of 10.99 or 5.50 or 10 ete.g if there are five items bought for 10.99 and 1 bought for 10, the script will multiply 10.99 by 3, then multiply 10 by one, then add the two results.

The resulting number is sometimes right, but quite often it ads an extra '000000002' or so to the amount??

[Code]...

View 3 Replies View Related

Easier Type Handling

Sep 9, 2007

a common task when writing multi-use functions, is deciphering the type of data passed to the function.

Javascript's built-in data identification methods complicate function writing, by imposing a "20 questions" style interogation to determine the actual, useful to a programmer, type.

they also slow down functions, requiring both a function execution and a comparision operation upon every type guess.

a common method is something like:
if(typeof x=='string'){ };

but this has several limitations. for example:
x=[1,2,3];
typeof x; //returns 'object'

safely catching an undefined is often done like:
if(typeof x != 'undefined' ){ };

my function making got a lot easier after writing these simple prototypes:

String.prototype.type="string";
Array.prototype.type="array";
Number.prototype.type="number";
Boolean.prototype.type="boolean";
Date.prototype.type="date";
Object.prototype.type="object";
RegExp.prototype.type="regexp";
Function.prototype.type="function"
if(!!window.XML)XML.prototype.type="xml";

String.prototype.isString=1;
Array.prototype.isArray=1;
Number.prototype.isNumber=1;
Boolean.prototype.isBoolean=1;
Date.prototype.isDate=1;
Object.prototype.isObject=1;
RegExp.prototype.isRegExp=1;
Function.prototype.isFunction=1;
if(!!window.XML)XML.prototype.isXML=1;

the result?

shorter simpler code.

examples:

// smarter object typin':
[1,2,3].type; //returns 'array'


//when expecting a string or array possibility:
y=x.isString?x:x.join();

//more-flexible event handling:

function doBold(elm){ //accepts element object or id string...
if(elm.isString){elm=document.getElementById(elm);}
elm.style.fontWeight="bold";
}//end doBold


// detect an undefined variable:
if( ! x.type){ alert('x is undefined')};



by tucking the protos in your script file, you get simpler, faster-executing code. (for a tiny bit of overhead)

if script length is of upmost concern (as in a bookmarklet), these smaller protos give you simpler typing: (without the speed benefits...)

Object.prototype.type=function(){return typeof this;};
//usage:
switch(x.type()){
case 'string': return x;
case 'date': return x.toLocaleString();
case 'array': return x.join('
');
default: return x.toString();
}//end switch;

//another one:
Object.prototype.isType=function(strType){return (!! typeof this === strType)};
//usage:
x=101;
x.isType('string'); //returns false
x.isType('number'); //returns true

View 12 Replies View Related

Event Handling And Nested Div

Jan 20, 2008

I have two div elements (both dynamically created, one within the other). The parent div has an event attached to it:

contextmenuDIV.onmouseout = function () {doSomething()}

for example. However the onmouseout event will fire when you mouseover the child div as (of course) I am technically leaving the div layer (despite it being the parent).

Is there anyway to cancel this? I've read all about bubbling and all that, but it's just confusing me even more!

Anyway, at all, to allow me to have divs within another div element but only allow the event to fire for the parent!

View 2 Replies View Related

Inline Vs Dom Event Handling?

Jan 11, 2009

why I should use the dom level 2 event handling over inline events like ...

Code HTML4Strict:
<a href="http://www.yahoo.com" onClick="myFunction()">click me</a>

I work in a team of developers and our pages are dynamically created using Java.I can at any moment change the inline JS across a site due to this so changes are easier then if the site was just static HTML.As far as reasons to use dom 2 over inline, I looking for something beyond:

it separates behavior from html

it is a best practice

it is the 'modern' way of doing it

I need facts that explain why it is a best practice or why 'modern' is better like : you can only assign one function action to the event.That was just an example which I see but is not true to me.I can either assign multiple functions to it like:

Code HTML4Strict:
<a href="http://www.yahoo.com" onClick="myFunctionA();myFunctionB();myFunctionC()">click me</a>

or I can call my functions from a single function call like

Code HTML4Strict: <a href="http://www.yahoo.com" onClick="myMultiFunctionCall()">click me</a>

and then have a function defined before the inline call like

Code JavaScript:
function myMultiFunctionCall()
{[code].....

Here the second statement overwrites the first.By the way, here is a con for using dom and to me a big one considering debugging: you can't see what event handlers are assigned to what unlike inline where it is obvious because it is in the page. see http:[url].......

View 5 Replies View Related

Handling A Variable With Flash

Jan 6, 2010

The following bit of javascript writes and retrieves a cookie which counts a users visits to the page. Then using swfobject it both embeds main_banner.swf and passes the cookie value "visits" to it via flashvars. The trouble is in the actionscript below; the vallue has been passed (this is certain, because the .swf shows up rather than the alternative content)- but the .swf is stuck on the first frame rather than processing the cookie and sending the user to the appropriate frame label.

View 1 Replies View Related

Mouse Over Event Handling?

Nov 17, 2011

I am having a list (ul) in which a mouse over will populate its sub categories as list under that(like tree) and so on. My problem is, when passes mouse over a 2nd or 3rd level element, 2 mouse over events will be fired (The actual one and its parent) The sample code is given below

HTML Code:
<ul>
<li>
Root[code]............

View 2 Replies View Related

Handling An Onclick With Two Actions

Apr 28, 2010

How can I have a button with onclick that calls a function which returns a true/false based on the associated input, and based on the return value shows a message that it was true or false. I see how onclick can call one function, but is there a way to call two functions and use the return value of one of the functions?

[Code]....

View 3 Replies View Related

Problems In Handling Redirections Within IFRAME

Jan 6, 2007

I am using IFRAMES to load 3rd party domains in my website. I am facing
few problems using IFRAMES in IE and Firefox.

1) I am unable to login into the 3rd party website within the IFRAME.
Is there any solution to overcome this issue?

2) Upon clicking a link inside 3rd party wesite within the IFRAME, the
resulting page is not loading within the IFRAME, it is going out of
scope. For example clicking MyMail link in yahoo.

View 3 Replies View Related

Handling Multiple Forms On A Single JSP

Jul 20, 2005

I have a JSP page with several forms on it. Some of these forms are
generated dynamically, and each of them submits some information to a
database.

Handling one form is easy, as I can simply make the form post to
itself, and handle the
data using a single bean. Since I have multiple forms, I now have a
problem. Several of the forms on the page handle the same type of data
(same input names), and a 'setproperty *' call for each of the form
beans would change data in several beasn, not just the form/bean that
sent the data.

I am attempting to write a separate JSP with a single bean that
handles a form submission. However, I'm not sure how to make this page
go back to the referring page from which the data was submitted.

View 1 Replies View Related

JQuery :: Handling Forms In Tabs?

Aug 19, 2009

I have a form with the same structure being loaded in 3 tabs. Now during validation, I will have issues with the IDs of the form fields. Now is it possible to disable the forms in tab 1 and tab 3 when tab 2 is clicked.

View 1 Replies View Related

JQuery :: Internals And Exception Handling?

Aug 19, 2009

Couple questions for the jQuery internals-aware folks. This is a bit long, sorry for that. I'm working on beefing up error handling in a web application. I want to ensure that I'm catching all exceptions and handling them via my own UI system. The window.onerror function is part of the solution,

[Code]...

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved