Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Javascript "opener" issues

Options
  • 07-11-2006 8:27am
    #1
    Registered Users Posts: 6,240 ✭✭✭


    Hey all
    I'm really stuck here and have no idea on how to procede

    In a form I have,
    I have (this is a simple version btw) a text box with name "l_Street Address" in a form "myForm"
    when I click a link, it opens a child window where the user types in the values (this gets validated against an external system)
    and it returns the javascript
    function pasteAddress()
    {
    	if (opener.g_streetAddr) {
    	    opener.g_streetAddr.value = document.PopupForm.Address[0].value;
    	  }
    }
    

    now in my parent window
    I have a call
    <form method="POST" name="myForm" action="">
    <input type="text" name="l_Street Address" id="l_Street Address" value="" size="50">
    <a href='Javascript:onClick = QASPopUp(document.myForm,"l_Street Address")'>Add Address</a>
    </form>
    

    and this calls a javascript function
    <script type="text/javascript">
    var qasWindow;
    function QASPopUp(thisForm, addr) {
      g_streetAddr = thisForm.elements[i];
      qasWindow = window.open("2.html", "2Window", "toolbar=false, scrollbars, status, height=550, width=700");
    }
    

    Now this works fine locally (1.html can call 2.html in the same folder), but when I try on a server I get problems

    the child window is in a domain XXXX.company.com
    (so instead of 2.html I call "http://XXXX.company.com/file.html")
    and the parent is in
    YYYY.company.com:9081/file.html (instead of 1.html)

    and the child window returns a "permission denied" javascript error.
    is this because of the XXXX/YYYY difference or the port?

    is there an easy way around this? ... or is it a different cause of the error?
    I can't run my parent file in XXXX.company.com

    I'm running it on localhost:9081 but in my hosts file have YYYY.company.com mapped to 127.0.0.1


Comments

  • Registered Users Posts: 1,275 ✭✭✭bpmurray


    This is a security feature - you can't jump around the web from a single JS. However, you can override the cross-domain issue using calls like (for firefox/netscape):

    netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");

    I don't know if this is possible in IE.


Advertisement