Document.domain - Not Accurate ?

Jul 28, 2011

Okay, reason I say that is, its not accurate to the actual domain that the "script" is located on.

For example, domain.com has the <script url=domain2.com/jsfile> which has " document.domain " (this = domain.com)

However, if i have frame of domain3.com which frames domain.com the domain will show domain3.com but thats not what I care about, I want domain.com since thats whats actually being shown.

View 6 Replies


ADVERTISEMENT

Catch Invalid Document.domain Set ?

Mar 23, 2010

I do my development on a local PC before putting the code onto a website.

Something I need to do is set the document.domain to the top level domain for a page. The top level domain will be supplied via config item.

The small issue is that my top level domain when developing is "mypc" and attempting to set document.domain to "mypc" kills the javascript.

I tried this as a work around:

Code:

But this still triggers a complete failure of javascript on the page. I also tried using eval to do it, but it still kills things.

It there another trick to try setting the domain without dieing that doesn't involve validating the domain string before attempting to set it?

[Edit] I am aware that it's dieing because "mypc" is clearly not a FQDN as it expects.

View 4 Replies View Related

Document.domain Or Window.location.host ?

Mar 3, 2009

I need to get the domain of the page (mydomain.com) There seems to be 2 variables to get this info. document.domain & window.location.host - Both are set in FF & IE. So whats the difference between these ?

View 1 Replies View Related

Document.domain Issues And Cross Server Scripting

Jul 23, 2005

I'm working on a project at the office that pulls together a bunch of
our websites into a portal thing and adds a better search engine. We're
also trying to accomadate newer browsers (Netscape 7.2, Firefox,
Safari) and are having some problems. The websites run on different
servers, all of which we control, so we are setting the document.domain
= "ourdomain.com"; in some javascript on ever page. However, we're
having problems. We use popup windows for some things, and sometimes
these popups want to 'populate' the parent frame window with a new page
as a result of a user selection on the popup.

This works most of the
time, but not always. For instance, in Netscape 7.2 it just seems to
fail with an "access denied..." error in javascript. In Firefox and
Safari it opens a new window and populates that instead of populating
the original parent window. Can anyone point me at some definitive
information about the document.domain property and how to use it
effectively?

View 1 Replies View Related

Javascript Created IFrame Document, Weird Domain Issue

Aug 3, 2005

I have an IFrame whose document is created completely by Javascript code at
runtime. The document in the IFrame accesses Javascript functions in the
top level document. This works fine most of the time. But every now and
then, when I hit the back button, the browser suddenly thinks the Javascript
created document in the IFrame is not from the same domain as the topmost
document, and therefore I start getting "permission denied" errors when I
try to access the top level document's Javascript functions.

If I look at the IFrame document's properties (Mozilla->This Frame->View
Info), it shows the expected URL with a domain name that matches the top
level document.

View 2 Replies View Related

Formulas Not Accurate?

Aug 2, 2006

I am having trouble with my formulas for my salmon calculator. When I select seafoodgrill from the pull down menu and then enter 10.99 per lb, 85 % yield, and 25.50 price I get a 23% food cost. That is not correct. The correct answer should be around 24.6%. How have I set up the formula wrong. Code:

View 2 Replies View Related

Accurate Sizing Of Pop-up

Aug 24, 2002

I've been using pop-ups for some time now and I still can't figure out how to get the image to fit perfectly in the new window. There's always a few pixels of background showing and I have to increase the size of the window just to have the spaces around the image to even out. Is there any way to completely remove the vertical and horizontal spaces in pop-ups?

View 4 Replies View Related

Getting An Accurate Grand Total

Jan 24, 2007

I have a page that has a total field that will have a value when the page is loaded. I also have a few select options that modify the total via an onchange event. Problem is, when i change a select option twice, I cant work out how to get the correct total happening instead of just adding more to the total. I'll show you what I mean.. Code:

View 5 Replies View Related

JQuery :: .support.cors = True Only Allow Certain Domain - Load The Exact Same Json Data From Other Domain Or Localhost

Jan 4, 2012

I am doing some development using jQuery $.getJson lately and found the following weird scenario.

1. open google chrome without any argument then load a local html file.

2. the local html file will need to have $.getJson[url] .... bla bla bla and jQuery.support.cors = true.

3. data will get loaded

But if you try to load the exact same json data from other domain or localhost, it wouldn't works.

View 1 Replies View Related

JQuery :: Cross-Domain - Send Data Through POST To Other Domain

Oct 28, 2011

I need to send data through POST to other domain.

My script is:

But I am still getting the error XMLHttpRequest cannot load [url]. Origin [url] is not allowed by Access-Control-Allow-Origin.

XHR finished loading

I set in the destination

I don't know why it dosen't work.

View 2 Replies View Related

Accurate Stopwatch & Count-down Timer

Sep 16, 2006

I'm currently trying to make an accurate stopwatch and count-down timer. So far, I've just worked on the stopwatch, but it is inaccurate due to the calculation time of the Javascript. A more accurate method would perhaps be to compare the starting time and the current time, where the times are retrieved using the Date object. However, using this method I am not sure how to start/stop the timer (eg. I stop it at 1:00 and then start it again 5 minutes later, and it continues from the time it stopped - 1:01, 1:02, etc.). Code:

View 4 Replies View Related

Capturing Domain Change Event OR Domain Of The Target URL

Jun 7, 2009

Is it possible to capture the domain change event OR domain of the target site in javascript? To elaborate, suppose I am on my site (www.mydomain.com) and if I type www.someotherdomain.com in the address bar, I want to capture the target URL/domain i.e. someotherdomain.com in the javascript code of my site (mydomain.com). I am trying to call sign-off function of my site upon customer navigation to some other site without loggin off. I can not use body/window onUnload function because I have a common layout JSP that would be reloaded for each and every page. So I am trying to capture the URL/domain of target site and check if it is different from teh current domain; Then only I will call my sign-off function to kill the customer session.

View 2 Replies View Related

JQuery :: Slider Values Not Accurate At Ends?

Jun 1, 2009

<html>
<head>
<style>
.hmmessage P

[Code]....

No matter if I set min/max, step, etc....when sliding all the way left or right, the values are incorrect at the end. For example, with default values, sliding all the way left results in a value of 10....but moving back to the right slightly causes it to drop to 0 and then count up from there. The reverse is true for the right/high end. It's behaving this way in both IE7 and FF 3 on XP. [URL]

View 9 Replies View Related

AJAX :: Cross Domain Post - Post Data From A Form To A Page On Another Domain, Without Leaving The Current Page?

Jan 15, 2010

i need to post data from a form to a page on another domain, without leaving the current page.I am using ASP as a server language.

View 9 Replies View Related

Detect ,on Load Of The Html Document, Whether The Body Of The Iframe Document?

Sep 6, 2009

Suppose a HTML document has a iframe. Using javascript,I want to detect ,on load of the html document, whether the body of the iframe document is ready to be displayed.I want to be able to overwrite the the body contents (before it actullay loads) of the iframe.can I do it with jquery? say if ,HTML doc is

Code:
<html><head></head><body><iframe id="ifrmId" src="http://www.google.com" ></iframe></body></html>

View 1 Replies View Related

Function To Save An Html Document As An Microsoft Word Document?

Feb 9, 2010

i want to save my html document as an microsoft word document will

View 14 Replies View Related

Building SVG Document Using DOM Interface Inside HTML Document

Mar 17, 2007

Normally an SVG document is loaded/parsed/interpreted inside an HTML
document using an 'object' (or 'embed') element, although there are
supposedly other ways too. The problem is, the SVG document must be
static this way.

I want to use the DOM interface to build SVG dynamically inside an HTML
document. I am guessing I can build it inside HTML within an 'object' (or
maybe 'iframe'?) element.

My intentions/goals:

In Javascript, I construct an object 'embedSVG' which has properties and
methods for creating valid SVG elements and setting their attributes and
attribute values.

During construction, the SVG document is created with its root element.
During debugging in FF 2.0 (I'll work on an MSIE-compatible format later),
I am using the Mozilla DOM Inspector and comparing nodes when the
'object' element is loading a valid external SVG document, and when I am
appending the child representing the SVG document created by the DOM
functions.

However the child node (#document) does not specify 'svg' as the root
element, but instead 'HTML'. Something is not working.

Here is the relevant code in 'ScriptTest.html' which is the HTML in which
the SVG is supposed to be embedded. Below it is the relevant code for
'svglib.js' which is supposed to contain code for building the SVG
dynamically.

What this code is supposed to do is load the HTML page and execute the
anonymous script, and draw a navy blue-bordered yellow rectangle on a
blank page. This is similar to the example in the SVG 1.1 W3C
Recommendation on page 202 of the 719-page PDF.

I am getting an exception when embedSVG object placeInHTML() method is
called: NS_ERROR_DOM_HIERARCHY_REQUEST_ERR. I find in DOM Inspector in
spite of or after the exception that a document is placed as a child of
the object element, but it is HTML, with a default 'head', 'title',
'body' elements placed.

Where am I blowing it?

View 3 Replies View Related

Javascript Document History - Is It Possible To Know The Previously Viewed Document?

Jul 24, 2001

Determine what the previous page was that the user was viewing, even if the user arrived at my site by through the use of a browser function (history, location bar, refresh, etc.). Is this possible?

I'm not wuite sure how document.history functions - what degree of privacy is given to the user and to what extent can web pages get URLs from the user's history?

View 2 Replies View Related

Document But When Using The Object Onmousemove It Seems To Run The Code Even If The Mouse Is Still Over Then Document

Dec 6, 2010

I am trying to make a function run if the mouse is moved over the document but when using the object onmousemove it seems to run the code even if the mouse is still over then document, how can I make it so if the mouse is over the document but isn't moving then don't run the code but once the mouse moves run the code? This is the code I made to handle the mouse move collections.

[Code]..

But with this code it runs even when the user doesn't move their mouse and the notification box pops up every second as the code seems to think a still mouse is a moving mouse.

I was thinking about having a run once system but that would mean if the mouse moves it runs once and then if the mouse moves again the code will not run as it has already ran before.

View 5 Replies View Related

Document.onkeyPRESS || Document.onkeyDOWN Dynamically?

Oct 26, 2007

I want to switch a big function from a document.onkeydown = function to a document.onkeypress = function, or vice versa depeding on the type of browser.

However it is quite a big function so it's pretty much out of the question to have it appear in full twice.

Any ideas how to change the target event (onkeydown/onkeypress) without writing the whole function twice?

View 8 Replies View Related

Building The Document In A New Window Entirely With Document.write

Apr 22, 2006

I am working on creating a document where you check a bunch of checkboxes to select what to include, then click on a button. A function then opens a new window and writes the HTML code to run scripts in .js files to populate the page. Code:

View 4 Replies View Related

Document.write() - Trap Changes Done To The Document Object

Jun 5, 2006

I have been searching for a way to trap changes done to the document object (mainly by the function document.write();).

Example of code that doesn't work:

function myFunction() {
ed.document.onchange = doFunction(document.body.innerHTML);
ed.document.open();
ed.document.write('Hello');
ed.document.close();
}

function do_function(body) {
alert(body);
}

It only fires when the page loads, not when I change the text. You are free to use any event that works, but i think onchange was the one to fit this problem. The alert will write the initialpage, but will never write the tekst 'Hello' that is the new change.

Any javagurus out there know a solution to pick up any fired events triggered by document.write();

View 6 Replies View Related

Line Using Document.write() And Document.writeln()?

Jul 16, 2010

I am trying to write a bunch of text onto a new document using document.write() and somehow need to format it to include line breaks.

For example:
Code JavaScript:
document.write(Line 1);
document.write(Line 2);

I have tried including and it does not work. I have also tried document.writeln() and that also does not work. From what I have found on the Internet, one (if not both) of those methods should have worked.

View 3 Replies View Related

Get Domain From URL

Aug 4, 2009

How do i get the domain from a URL ?

Some domains are ( com co.uk us gov ie net org ) so all I need is the domain itself.

So far all i can get is the hostname and domain...

View 8 Replies View Related

Redirct Domain

Sep 4, 2005

I have a web site to which multiple domains point and I want to redirect to
a specific subdirectory for specific domain references. I found the
following script and am trying to use it but I cannot get it to work. I
added the alert statements to try to see what is happening but they both
retund a value of 0? Any ideas as to how I can accomplish this? Code:

View 6 Replies View Related

JQuery :: Different CSS Per Domain?

Jan 30, 2010

Looking to set up a website which will have several different domains pointing to the same pages - different personalised branding but same content. I'd like to load a different set of style sheets based on which domain they visited the page via, and allow this setting to be remembered in a session cookie so each page they visit will continue with the same personalised style.

Had a good look around, and seen a few style switchers, but nothing which bases the switch on the domain. Anyone able to point be in the direction of a plugin or similar that would me out?

View 5 Replies View Related







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