Newbie: Ajax permission'g question

Discussion in 'HTML' started by hemant.singh@gmail.com, Apr 17, 2006.

  1. Guest

    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
    , Apr 17, 2006
    #1
    1. Advertising

  2. Neredbojias Guest

    To further the education of mankind, 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.
    Neredbojias, Apr 17, 2006
    #2
    1. Advertising

  3. Guest

    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
    , Apr 17, 2006
    #3
  4. 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
    Hywel Jenkins, Apr 17, 2006
    #4
  5. Guest

    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...
    , Apr 17, 2006
    #5
  6. Neredbojias Guest

    To further the education of mankind, 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.
    Neredbojias, Apr 17, 2006
    #6
  7. 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
    Hywel Jenkins, Apr 17, 2006
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ann

    newbie permission problem

    Ann, Oct 3, 2004, in forum: Python
    Replies:
    9
    Views:
    544
    Peter Abel
    Oct 4, 2004
  2. minnie
    Replies:
    1
    Views:
    683
    Andrew Thompson
    Dec 13, 2006
  3. Tony K
    Replies:
    2
    Views:
    1,031
    Tony K
    May 4, 2007
  4. Replies:
    5
    Views:
    119
    Lasse Reichstein Nielsen
    Apr 17, 2006
  5. nick

    Unique AJAX permission problem

    nick, Oct 25, 2006, in forum: Javascript
    Replies:
    2
    Views:
    80
    Randy Webb
    Oct 25, 2006
Loading...

Share This Page