Javascript window.open not working in IE

I want the link to open in a new window, but when I click on write_review in IE, it opens in a new tab. I checked the spaces in the arguments that cause the problem. But no problem with that.

I checked by URL: - Javascript window.open is blocked by IE popup blocker

But it does not work for me ..

This is my working code in another browser.

// Opening pop-up window for the write review jQuery('a#write_review').click(function() { var w = 1000; var h = 650; var left = (screen.width/2)-(w/2); var top = (screen.height/2)-(h/2); var planid=$(this).parent().parent().find('input[name="data[PlanIdsel]"]').val(); var providerid=$(this).parent().parent().find('input[name="data[ProviderIdsel]"]').val(); var rep=$(this).parent().parent().find('input[name="data[Repsel]"]').val(); var url = "<?php echo $this->webroot ?>"+"enrollments/write_rating/"+planid+"?Rep="+rep+"&providerId="+providerid; window.open(url, 'subWind', 'status, scrollbars, resizable, dependent, width='+w+', height='+h+', left='+left+', top='+top); }); 

I ask you to notify me or correct me.

+4
source share
2 answers

check this How do you get window.open to work in Internet Explorer 7?

This is part of the security changes made in IE6. Now you can call "window.open" only from a user-initiated event. For example, your code will work inside the onclick element. The MSDN "window.open" page says this.

link

+4
source
 $(document).ready(function(){ $("a#ID of your link").click(function(){ var w = 1000; var h = 650; var left = (screen.width/2)-(w/2); var top = (screen.height/2)-(h/2); var url = "your url"; window.open(url, 'subWind', 'status, scrollbars, resizable, dependent, width='+w+', height='+h+', left='+left+', top='+top); }); }); 

this should work.

+3
source

Source: https://habr.com/ru/post/1444755/


All Articles