SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard holmescreek's Avatar
    Join Date
    Mar 2001
    Location
    Northwest Florida
    Posts
    1,707
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Angry location.href - page keeps loading page

    Hi,

    I have a little code, basically, it does a modal pop-up and once the modal pop-up is closed the page is supposed to refresh. The problem is, the first time the modal window pops up and closes the page loads fine. However, the next time you open the modal window and close it the page refreshes to the correct url, displays the page, but the page just keeps on loading forever.

    Here is the code. Any suggestions?

    Code:
      <script language="Javascript">
       
         function PopStory(bid,sectionid){
    		var bannerwindow;   
    		var leftPos = (screen.availWidth-748) / 2
    		var topPos = (screen.availHeight-478) / 2 
    		var cmd = 'editstory.php?id=' + bid + '&SECTION=' + sectionid;
    							
    		var returnlocation = './index.php?PAGE=<?php echo $PAGE;?>&SECTION=<?php echo $SECTION; ?>';
    							  
    		bannerwindow = window.showModalDialog(cmd, "","dialogWidth=748px;dialogHeight=478px;status:off;");
                                        
                location.href = returnlocation;
    								
    	}
    							                              
     
    	</script>
    intragenesis, llc professional web & graphic design

  2. #2
    SitePoint Wizard
    Join Date
    Mar 2004
    Posts
    1,647
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you forgot to define on which object you want add the location.href...
    maybe the object will be window...
    and btw... define the relative path....
    cheers

  3. #3
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,875
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    There is no code there to handle poping up anything for browsers other than Internet Explorer. Is this on an intranet?
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  4. #4
    SitePoint Wizard holmescreek's Avatar
    Join Date
    Mar 2001
    Location
    Northwest Florida
    Posts
    1,707
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by reminder
    you forgot to define on which object you want add the location.href...
    maybe the object will be window...
    and btw... define the relative path....
    cheers

    location.href should assume itself.

    If you look close, the pop up is in a modal state so the location.href runs only after the modal pop-up is closed.



    (yes, this is on an intranet)
    intragenesis, llc professional web & graphic design


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
  •