Payment popup Blocker Solution

Source: Internet
Author: User

Read a lot of work to solve this method of the article, but for the Ajax request pop-up windows are useless, until you see this article only enlightened, in fact, is very simple, the following is copied over the article.

Window.Open is a JavaScript function, the function is to open a new window or this change the original window, but the general use is to open a new window, because the original web address can be modified to use window.location, you can redirect the page address, so that the page jumps to another page.

However, in general, if you call the window.open () function directly in JS to open a new window, the browser will block the popup window, because the browser will consider the window as pop-up ads and other users do not want to get the form, if you do not want to let the browser intercept, The solution is to change the window.open () function to be triggered by the user's active click, so the browser thinks the user wants to access the page instead of popping it directly to the user.

So the usual method is to add the onclick event to the hyperlink, such as

<a href= "javascript:void (0)" onclick= "window.open ()" ></a>

  

So the user clicks on this hyperlink, the browser will think it is open a new link, so it will not intercept.

But sometimes encounter want to pop up a window, but it is in the Onckick event after the execution, only to play out, such as the use of $. JSON, click to get the data, then jump to the new page, then it will be blocked by the browser, we can use the following method to avoid, is to first open a window with window.open, and then modify the window address.

As in $. JSON before defining the variable opens a window with the following code:

var tempwindow=window.open ();

And then to $. The address returned by JSON uses the following code to make the window jump to the specified URL, which renders the new window pop-up and will not be blocked by the browser.

tempwindow.location= '/jump/new ';

  

Change the address of the above jump to $. JSON returns the variable or page that you want to jump to.

Transferred from: Http://www.tuicool.com/articles/qaYzmey

Payment popup Blocker Solution

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.