JS method that pops up a new window without being blocked by the browser

Source: Internet
Author: User
Convert from: JS pop-up new window without being blocked by the browser

Sometimes you want to use js to open a new window, but the window opened using window. Open is always blocked by the browser,

You can use the following method to open a new window without being intercepted.

1. Add a new form

<Form ID = "emailform" Action ="Target page"Method =" get"Target= "_ Blank">
<Input id = "emailid" name = "emailid" type = "hidden"/> //Hidden field, used to put parameters to be passed
</Form>

Note that the target attribute of form must be set to _ blank.

2. Submit this form

Function btneditemail_onclick (){
Document. getelementbyid ("emailid"). value = ID ;//Initial hidden domain
Document. getelementbyid ("emailform"). Submit ();//Submit
}

In this way, the new window will be opened and directed to the target page, and will not be blocked, and the new window will be used at the same time.OpenerYou can also access the original window.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.