Use JavaScript to determine whether the browser has disabled the pop-up window, and prompt the website viewer in a friendly way on the webpage.

Source: Internet
Author: User
Use JavaScript to determine whether the browser has disabled the pop-up window, and prompt the website viewer in a friendly way on the webpage.

Pop-up Blocker or other software that shields pop-up window advertisements (such as Google Toolbar) will shield any windows automatically opened by scripts except createpopup.
Some common functions affected by this are window. open (), showmodelessdialog (), showmodaldialog (), showHelp (), window. External. navigateandfind ().

The following JS can be used to detect and prompt the website viewer in a friendly way on the webpage.

Program code <HTML>
<Head>
<Title> settings in the pop-up window </title>
<Script language = JavaScript>
Function openwin ()
{
VaR sreturn = Window. Open ("http://www.geto.cn ");
If (sreturn = NULL)
{
Errorlog. innerhtml = "<font color = Red> the pop-up window on this site is blocked. Modify the browser configuration if you want to view the window! </Font> ";
}
}
</SCRIPT>
</Head>
<Body onload = "openwin ()">
<Div id = "errorlog"> </div>
</Body>
</Html>

 

Related Article

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.