Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Javascript "opener" issues

  • 07-11-2006 08:27AM
    #1
    Registered Users, Registered Users 2 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, Registered Users 2 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