Obtaining a variable value

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • hendedav@yahoo.com

    #1

    Obtaining a variable value

    Hi gang. As with any other post, I am working on a project and have
    gotten stuck. I am trying to obtain a variable value in the parent
    webpage from an <iframe>. For instance:

    Parent Page code
    ----------------
    <html>
    .... heading tags
    <body>

    <iframe name="testing" marginwidth="1" marginheight="1 "
    src="http://www.interneturl .com/webpage.php" height="160" width="300"
    scrolling="no" border="0" frameborder="0" >&nbsp;</iframe>

    </body>
    </html>


    When I try to access a variable value in that <iframe> it gives me the
    error:
    "uncaught exception: Permission denied to get property
    Window.variable name". Obviously the <iframe> contains code from a
    webpage that is not in the local domain (ie a local file). Would this
    be causing the problem? If so, is there a way to get around this? I
    have tried accessing the variable value from the ways listed below:

    testing.variabl ename *seems to work on local files*
    testing.documen t.variablename
    parent.frames['testing'].variablename
    parent.frames['testing'].document.varia blename
    frames['testing'].variablename
    frames['testing'].document.varia blename

    Any help that can be given will be greatly appreciated... thanks in
    advance.

    Dave

  • kaeli

    #2
    Re: Obtaining a variable value

    In article <1111334742.491 074.75010@g14g2 000cwa.googlegr oups.com>,
    hendedav@yahoo. com enlightened us with...
    [color=blue]
    > When I try to access a variable value in that <iframe> it gives me the
    > error:
    > "uncaught exception: Permission denied to get property
    > Window.variable name". Obviously the <iframe> contains code from a
    > webpage that is not in the local domain (ie a local file). Would this
    > be causing the problem?[/color]

    Yes.
    You're only allowed to access documents from the same domain and protocol.
    [color=blue]
    > If so, is there a way to get around this?[/color]

    No. Not with client-side javascript. (if there is, it's a security hack)
    Can you imagine what unscrupulous people could do if it were allowed?

    If both pages belong to you, use parameter passing via the URL or cookies.

    --
    --
    ~kaeli~
    Santa's helpers are subordinate clauses.



    Comment

    • hendedav@yahoo.com

      #3
      Re: Obtaining a variable value

      Thanks for your reply Kaeli. I guess I will have to rethink my plans
      on how to get this variable value.

      I do have another question for everyone. Is there anyway you can get
      javascript to sync time with a national time server? Any examples are
      welcomed.

      Dave

      Comment

      • kaeli

        #4
        Re: Obtaining a variable value

        In article <1111448408.773 794.244710@o13g 2000cwo.googleg roups.com>,
        hendedav@yahoo. com enlightened us with...[color=blue]
        > Thanks for your reply Kaeli. I guess I will have to rethink my plans
        > on how to get this variable value.
        >[/color]

        What is the variable used for?
        Is the page yours? You have a lot more options if it is.

        Do you have a server-side scripting language, such as PHP, available? Server-
        side languages can read in contents from a URL. Javascript can, too, but it
        needs help. Check this out.

        [color=blue]
        > I do have another question for everyone. Is there anyway you can get
        > javascript to sync time with a national time server?[/color]

        Depends. You run into the same issue as your other problem -- javascript
        talking to another server. With possibly the same solution (http request or
        using server-side scripting).
        Do they have a web service?

        --
        --
        ~kaeli~
        I love God. It's His fanclub that I can't stand.



        Comment

        Working...