View Full Version : Open URL in another tab/window
11-17-2010, 12:21 PM
Just wondering if there is a way of opening a location in a new tab/window on the users browser, without the user having to click any thing?
Basically, my code allows the user to select an XML file which is then manipulated and saved to the server (need this as a record of what has been edited), and as the final step I'd like the file displayed to the user, but in another tab.
11-17-2010, 12:28 PM
Is this what you are looking for?
You can edit the Timeout to 0 if you want it to redirect instantly.
window.open = '<?php echo "url_of_document.xml"; ?>';
I have edited it to "window.open" so it opens a new window.
11-17-2010, 12:34 PM
Thanks for the quick reply. It's pretty much what I am trying to do, only I'd like the file opened in a new tab/window so that the original page is still there.
Also, just tried the code you supplied and it's giving me 'Error on page'.
11-17-2010, 12:39 PM
This will work, you can adjust other elements also.
11-17-2010, 12:55 PM
The code is pretty self explanitory, thanks for that.
Plugged it in and still getting 'Error on page' though. If I change the timeout the 'Error on page' message does not kick in until after the the function fires. the file location is correct, as tried printing to screen and it works fine.
11-17-2010, 01:57 PM
Thats strange, it works fine on my browser, I have replaced the url with http://google.com and it works fine.
Here is the exact script:
window.open('http://google.com' , 'mywin' , 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0');
11-17-2010, 02:10 PM
Hmm, it works with Google, but will not work with my XML file - even if I make a clickable link to the file location it doesn't want to know, which is odd as the location is correct. Guess I'll have to put this on the back burner for the time being!
Thanks for the help.
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.