x1nick Posted March 5, 2010 Share Posted March 5, 2010 For my PHP framework I have a debug window which pops up when debugging is enabled var dwindow = window.open('debug.php','debugwindow',',toolbar=1,resizable=1,scrollbars=yes'); Now at the moment this line is used every time a page is loaded (in the main window) it always opens in the same single pop up window. Im wondering is there a way I can either check to see if the window is open then issue the line of code above. OR If I have to use window.open every time, is there a way I can only let a set of code run once the debug.php has been opened? Thanks Quote Link to comment Share on other sites More sharing options...
Psycho Posted March 5, 2010 Share Posted March 5, 2010 I'm really not following what you want. Are you wanting a new window to open for each error? If so, just change the window name to an empty string. var dwindow = window.open('debug.php','',',toolbar=1,resizable=1,scrollbars=yes'); Quote Link to comment Share on other sites More sharing options...
Omirion Posted March 5, 2010 Share Posted March 5, 2010 Im wondering is there a way I can either check to see if the window is open then issue the line of code above. I don't quite understand what you are trying to achieve. If you want to open the window only if you have opened it before. In theory: 1: Make an object 2: Give that object a trigger property of 0. 3: Set it to one when you open a new window. 4: Make a method that checks if trigger == 0. Quote Link to comment Share on other sites More sharing options...
Omirion Posted March 6, 2010 Share Posted March 6, 2010 Suggested from a friend: When the window opens set a cookie to true. Do whatever (Open window, run code etc) only when cookie is true Quote Link to comment Share on other sites More sharing options...
haku Posted March 6, 2010 Share Posted March 6, 2010 You only need cookies if you are wanting to save the state of the window across page refreshes. If it's within one page, then the other suggestions give above are fine. Quote Link to comment Share on other sites More sharing options...
x1nick Posted March 7, 2010 Author Share Posted March 7, 2010 Will try explain again: User opens index.php If debug mode is enabled a single pop up window is opened (only one window is required, code in first post does this) When user requests additional pages eg index.php?page=news (as an example) I need some javascript that will check to see if the previous debug window that has been opened, is still open. To put additional items into my debug window I use jQuery prepend function. So I need to check that the debug page has loaded before I can prepend items to my div table. Guess the last one is the most important, as I need to make sure that the debug window is loaded first before trying to make changes in the window Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.