Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Newbie: Ajax permission'g question

Reply
Thread Tools

Newbie: Ajax permission'g question

 
 
hemant.singh@gmail.com
Guest
Posts: n/a
 
      04-17-2006
Hello all,
I am developing a solution(JS/Ajax+ruby) which will be hosted on say
domain x.com

now my client can be comg from any domain, all they need to do is

<!-- Magic script starts -->
<div id="mymagic">
<script src="http://x.com/javascripts/client.js" />
<script type='text/javascript'>
showThemReality();
</script>
</div>
<!-- Magic script ends -->

Now the client.js loaded from x.com is making a ajax connection to
x.com, is this a issue? If not than how to access x.com server scripts
from client.js? I am try'g and it is giving me permission denied
exception.

Any help/pointer will be greatly appreciated

TIA
Hemu

 
Reply With Quote
 
 
 
 
Neredbojias
Guest
Posts: n/a
 
      04-17-2006
To further the education of mankind, http://www.velocityreviews.com/forums/(E-Mail Removed) vouchsafed:

> Hello all,
> I am developing a solution(JS/Ajax+ruby) which will be hosted on say
> domain x.com
>
> now my client can be comg from any domain, all they need to do is
>
> <!-- Magic script starts -->
> <div id="mymagic">
> <script src="http://x.com/javascripts/client.js" />
> <script type='text/javascript'>
> showThemReality();
> </script>
> </div>
> <!-- Magic script ends -->
>
> Now the client.js loaded from x.com is making a ajax connection to
> x.com, is this a issue? If not than how to access x.com server scripts
> from client.js? I am try'g and it is giving me permission denied
> exception.


You don't have your first script element properly closed.
(Group deja vu?)

As for the source of javascript files, one can normally call a .js file
from any domain.

--
Neredbojias
Infinity can have limits.
 
Reply With Quote
 
 
 
 
hemant.singh@gmail.com
Guest
Posts: n/a
 
      04-17-2006
Neredbojias,
Thanks for your comments ...
1) Why first script element is not properly closed? As I am using same
element to close it, not sure if there is some mistake, please point
out
2) yes I know .js can be loaded from any domain, and this is pretty
good thingy, but now that loaded js from a different domain want to
make a xmlhttprequest connection to the domain it is loaded from, which
is different from the domain where html page is being loaded, and here
i get permission'g issue, any idea how to avoid it ?

TIA

 
Reply With Quote
 
Hywel Jenkins
Guest
Posts: n/a
 
      04-17-2006
(E-Mail Removed) wrote:
> Hello all,
> I am developing a solution(JS/Ajax+ruby) which will be hosted on say
> domain x.com
>
> now my client can be comg from any domain, all they need to do is
>
> <!-- Magic script starts -->
> <div id="mymagic">
> <script src="http://x.com/javascripts/client.js" />
> <script type='text/javascript'>
> showThemReality();
> </script>
> </div>
> <!-- Magic script ends -->
>
> Now the client.js loaded from x.com is making a ajax connection to
> x.com, is this a issue? If not than how to access x.com server scripts
> from client.js? I am try'g and it is giving me permission denied
> exception.



You've come up against the cross-domain scripting browser security.
This has been around for a long time. I suspect googling for "ajax
cross domain security" will yield something helpful.

--
Hywel
 
Reply With Quote
 
hemant.singh@gmail.com
Guest
Posts: n/a
 
      04-17-2006
Hywel
Thanks dude,
I think im leading to a solution soon, googlg won't help as they ask
for permission'g and all crazy stuff which is not practical in real
world, atleast not in mycase...

 
Reply With Quote
 
Neredbojias
Guest
Posts: n/a
 
      04-17-2006
To further the education of mankind, (E-Mail Removed) vouchsafed:

> Neredbojias,
> Thanks for your comments ...
> 1) Why first script element is not properly closed? As I am using same
> element to close it, not sure if there is some mistake, please point
> out


Should be:

<script type="text/javascript" src="something.js"></script>

then:

<script type="text/javascript">
//code here
</script>

> 2) yes I know .js can be loaded from any domain, and this is pretty
> good thingy, but now that loaded js from a different domain want to
> make a xmlhttprequest connection to the domain it is loaded from, which
> is different from the domain where html page is being loaded, and here
> i get permission'g issue, any idea how to avoid it ?


I see. I don't know much about Ajax so didn't realize the situation.
Liked Hywel's answer though am not sure it can be done (normally).

--
Neredbojias
Infinity can have limits.
 
Reply With Quote
 
Hywel Jenkins
Guest
Posts: n/a
 
      04-17-2006
(E-Mail Removed) wrote:
> Hywel
> Thanks dude,
> I think im leading to a solution soon, googlg won't help as they ask
> for permission'g and all crazy stuff which is not practical in real
> world, atleast not in mycase...


Quote properly when you respond to a post.

How about having some server-side PHP include get the JS for you?
Something like this:

<?php include("getclient.php"); ?>

Have getclient.php do something like

<?php include("http://x.com/javascripts/client.js"); ?>

client.js should include the opening and closing script tags. Of
course, the file could have any extension you like in that case, as it
will be downloaded, inline, to the client.

--
Hywel
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
An Ajax Dictionary... My first AJAX project... GreatDomainz@gmail.com HTML 20 03-31-2008 01:24 PM
Deploying ASP.NET AJAX-Enabled Web site to host without AJAX insta =?Utf-8?B?QnJpYW4gRWR3YXJkcw==?= ASP .Net 2 02-21-2007 10:22 PM
AJAX IDE and AJAX TOOL--The Release of JoyiStar AJAX WebShop 3 Beta minnie Java 1 12-13-2006 06:29 AM
Ajax installed.. where are Ajax controls like popup in my VS toolbox ?? jobs ASP .Net 0 11-06-2006 01:23 AM
beginner AJAX questions (AJAX.net) darrel ASP .Net 5 04-28-2006 06:42 PM



Advertisments