SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    May 2011
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Window.Open() method not working in IE8

    Hi all,

    I have a requirement to generate a dynamic HTML which will show popup having certain fields like logged in username and some other values which i can find in the client side. I've written javascripts for all the stuff and methods are working fine.

    Now, the problem is showing them in a pop-up with a close button. I developed a method constructHTML and return a variable having constructed HTML based on return values of javascript functions.

    Now, I opened a new window using window.open() and trying to write this html string variable to the new popup.

    The approach is working fine in Mozilla but not in IE. It gives me the following error -

    Webpage error details

    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 2.0.50727; InfoPath.2)
    Timestamp: Mon, 2 May 2011 10:48:52 UTC


    Message: Access is denied.

    Line: 57
    Char: 2
    Code: 0
    URI: PortalPageInfoPopup.js



    Here is the complete code snippet that I used:

    function invokePopUp() {

    //Create the popup
    var html = constructHTML(); //Return String HTML
    var prevDomain = document.domain;

    var popup = window.open('PortalPageInfoPopup.html',"_blank","resizeable,width=800,height=600");
    popup.document.domain = prevDomain;
    popup.document.write(html);

    if(!window.focus()){
    //alert("IN FOCUS");
    popup.focus();

    }

    }

  2. #2
    SitePoint Guru
    Join Date
    Sep 2006
    Posts
    731
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You cannot set a domain.
    Tab-indentation is a crime against humanity.

  3. #3
    SitePoint Member
    Join Date
    May 2011
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So, any idea how we can write that HTML string to Pop-up? I embedded that domain related code snippet assuming that cross-domain scripting is issue. Any code snippet will help me a lot.

    Thanks in advance.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •