Reputation: 116
I am using following code to open window in new tab, and it is working on IE and Mozilla. but it's didn't worked on Google Chrome. Code is:
<script language="javascript">
window.open('viewReport.aspx', '_newtab' );
</script>
Above code is inside div and When I set div is visible true it is open a new tab window on IE and Mozilla. Please help.
Thanks.
Upvotes: 0
Views: 72
Reputation: 943089
All modern browsers block window.open()
calls except when they are called in response to a user event (such as a click).
Since your one is called during the page load process, it is not in response to a user event.
Upvotes: 1
Reputation: 66688
Use _blank
instead in window.open()
Ex: window.open('http://google.com', '_blank')
Upvotes: 1