473,411 Members | 1,889 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,411 software developers and data experts.

Accessing javascript variable from another site?

Hello,

I am trying to access a javascript variable on another site. The site
requires the user to be logged in, so what I am doing is submitting a
form and redirecting the output to an IFRAME, which has a blank page
with a script block containing the variable I need access to.

However, when trying to access the variable, I get access is
denied/permission is denied error, due to the site being on another
domain (my page is actually hosted locally on the user's machine). I've
tried adding to trusted sites, etc. to no avail.

Is there anyway to accomplish what I am trying to do, without having to
resort to something exotic like custom activex control etc?

Aug 17 '06 #1
6 2340
le*****@insight.rr.com said the following on 8/17/2006 5:10 PM:
Hello,

I am trying to access a javascript variable on another site. The site
requires the user to be logged in, so what I am doing is submitting a
form and redirecting the output to an IFRAME, which has a blank page
with a script block containing the variable I need access to.

However, when trying to access the variable, I get access is
denied/permission is denied error, due to the site being on another
domain (my page is actually hosted locally on the user's machine). I've
tried adding to trusted sites, etc. to no avail.

Is there anyway to accomplish what I am trying to do, without having to
resort to something exotic like custom activex control etc?
Do an HTTPRequest submit of the form. It is also called "AJAX".

There are other ways as well.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Aug 17 '06 #2
Jon

Randy Webb wrote:
le*****@insight.rr.com said the following on 8/17/2006 5:10 PM:
Hello,

I am trying to access a javascript variable on another site. The site
requires the user to be logged in, so what I am doing is submitting a
form and redirecting the output to an IFRAME, which has a blank page
with a script block containing the variable I need access to.

However, when trying to access the variable, I get access is
denied/permission is denied error, due to the site being on another
domain (my page is actually hosted locally on the user's machine). I've
tried adding to trusted sites, etc. to no avail.

Is there anyway to accomplish what I am trying to do, without having to
resort to something exotic like custom activex control etc?

Do an HTTPRequest submit of the form. It is also called "AJAX".

There are other ways as well.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Any pointers or links on how to accomplish this?

Thanks!

Aug 17 '06 #3
it is not possible using javascript only, it works only in IE, not in
other browsers, thanks to security threads. Maybe you can do it using
e.g. combination of php and javascript - download the page from other
server using php to your server and then access anything on it

Aug 18 '06 #4
TKapler said the following on 8/18/2006 4:51 AM:

Please quote what you are replying to.

If you want to post a followup via groups.google.com, don't use the
"Reply" link at the bottom of the article. Click on "show options" at
the top of the article, then click on the "Reply" at the bottom of the
article headers.

<URL: http://www.safalra.com/special/googlegroupsreply/ >
it is not possible using javascript only,
Yes, it is quite possible.
it works only in IE,
If it is not possible, then how can it "work only in IE"? And your
statement that it is only possible in IE is wrong anyway.
not in other browsers,
Wrong again.
thanks to security threads.
Wrong again.
Maybe you can do it using e.g. combination of php and javascript
- download the page from other server using php to your server
and then access anything on it
You could do it with a combination of server side and client side
scripting but I can do it with pure client side scripting. And, it is
quite trivial at that.
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Aug 18 '06 #5

Randy Webb wrote:
Please quote what you are replying to.
sorry, i do not forgot that ggroups are often used also by mail. But
anyway in my groups we have rights to not include the text we reply to,
if it is the original sender

it is not possible using javascript only,
Yes, it is quite possible.
You are definitely better programmer than I am, but as far as i know
and as far as i read, javascript can only access pages in the same
domain. And I have tried several times with standard ajax routines and
with iframe and they all worked the same way - with no problems on IE,
but with security error in Opera and FF. I understand this security
problem, a hacker can try to open in e.g. hidden iframe with your bank
account/mails etc. and if you are logged in the same session, it would
allow him to show the content, so he could read it/manipulate it.
I have read the coresponding articles about that security messages on
FF and Opera forums, because for one intranet project i need to solve
it and both browsers have settings to allow this.
So If you say it is possible to access variable of the page on
different domain with the default settings on all browsers, i would
really welcome a code example, i could imediately use it in my
projects.

Thank you
Tomas

Aug 18 '06 #6
TKapler wrote:
[...]
You are definitely better programmer than I am, but as far as i know
and as far as i read, javascript can only access pages in the same
domain. And I have tried several times with standard ajax routines and
with iframe and they all worked the same way - with no problems on IE,
but with security error in Opera and FF. I understand this security
problem, a hacker can try to open in e.g. hidden iframe with your bank
account/mails etc. and if you are logged in the same session, it would
allow him to show the content, so he could read it/manipulate it.
I have read the coresponding articles about that security messages on
FF and Opera forums, because for one intranet project i need to solve
it and both browsers have settings to allow this.
Well, if you lower your browser security settings to the
"Are-you-nuts"-level, cross-domain scripting should work.

--
Bart

Aug 19 '06 #7

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

Similar topics

3
by: Peter | last post by:
Hello, Two newbie questions: 1) I have a javascript file with a function in it. From this function I want to access a variable in another javascript file -which is not inside a function. I...
2
by: Chris New | last post by:
G'Day All I am having trouble dynamically assigning a value to a table's cell from one frame to another frame. I've created a website that is primarily viewed in a frameset consisting of 2...
6
by: Alex Rast | last post by:
First of all, this is not a programming question. I'm a user, not programming in JavaScript. I'm not, however, a novice user or even a power user - I certainly know programming intimately as well...
5
by: ms_chika | last post by:
Hi to all, I have this problem in xsl wherein i want to access a variable in javascript and use it my xsl. How would i access or use a javscript variable in my xsl file? Please help. ...
14
by: tshad | last post by:
I posted this on the asp.net group, also. I wasn't sure whether this was an asp.net problem or a javascript problem. I have a page that was originally created from a program I found on the net...
6
by: Chris Styles | last post by:
Dear All, I've been using some code to verify form data quite happily, but i've recently changed the way my form is structured, and I can't get it to work now. Originally : The form is...
1
by: Arthur | last post by:
I have a mix web site, ASP and ASPX files. I have assigned a value to Session("Date") and the href to an ASPX page. When I further href to another ASP Page. The content in Session("Date") becoming...
1
by: CS Wong | last post by:
Hi, I have a page form where form elements are created dynamically using Javascript instead of programatically at the code-behind level. I have problems accessing the dynamically-created...
19
by: k.karthikit | last post by:
Hello all, In some hidden variable (<input type="hidden" name="hiddenId" value="test" /> ,i stored some value.I accessed the value "test" using var id = document.getElementById( 'hiddenId' );...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.