www.webdeveloper.com
Results 1 to 3 of 3

Thread: javascript window.location issue with chrome

  1. #1
    Join Date
    Apr 2010
    Posts
    3

    javascript window.location issue with chrome

    Hi,

    we have a web application where there is a listbox on the screen with list of different roles. if user wants to switch role, he needs to select new role so that new screen loads as per selection,

    javascript:

    switch (user) {
    case "Role1":
    window.middle.location.href = "/xml/Role1.xml";
    break;
    case "Role2":
    window.middle.location.href = "/xml/Role2.xml";
    break;
    case "Role3":
    window.middle.location.href = "/xml/Role3.xml";
    break;
    }

    html:

    <frameset framespacing="0" border="0" cols="10,*" frameborder="0" name="bodyframe">
    <frame name="middle" scrolling="no" target="main" src="/html/loading.html"/>
    <frame name="main" scrolling="auto" target="main" src=""/>
    </frameset>

    Problem is this works fine with IE, when opened in chrome, it says 'Uncaught TypeError: Cannot read property 'location' of undefined'. can you please help to fix this.

  2. #2
    Join Date
    Jun 2007
    Posts
    667
    If you're in frame 'main', the syntax is:
    Code:
    parent.frames.middle.location.href = ...
    Y_U U_G_A_E_U_ B_S_A_D_

  3. #3
    Join Date
    Apr 2010
    Posts
    3
    Thanks for quick response. I used parent.frames.middle.location.href, but seeing same issue. how will I know if I am on frame 'main'. code I attached to this thread was from function called buildMenu(), and this is being called only while initially loading screen.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles