I have a link on my site that when you click it, it uses the window.open function. (I have to use window.open for another reason) but when the user clicks the link, a whole new browser window pops up. I want the code to window.open the new page, then close the previous page. Heres my code so far:
Why do you want to close the old page? Could you just use location.href = 'new location'; to change the location of the current page?
If you insist on opening a new page and closing the old one, you can use window.close(); to close the current window, but browsers won't close the main window without asking the user whether they want it to close first. If it's a window that you previously opened using window.open(), then you're free to use window.close() on it.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)