| |

VerySource

 Forgot password?
 Register
Search
View: 1263|Reply: 6

How to control the pop-up window is opened once, JavaScript master invited

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-1-3 13:10:01
| Show all posts |Read mode
How to control the popup is opened once:
When the page is first opened, a .js file will be called in the code, and a window will pop up in the .js file.
What if the window controlled by the .js file no longer pops up when the page is refreshed when the pop-up window is not closed?

Wait online!
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-1-3 17:15:02
| Show all posts
var once;
once = 1;
if (once == 1) {
window.open ();
once = 2;
}
Give an idea
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-1-6 13:48:01
| Show all posts
You can also create a mold window, related instructions: http://dev.csdn.net/develop/article/15/15113.shtm
Reply

Use magic Report

0

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-1-7 10:15:01
| Show all posts
Write a cookie
document.cookies = cookieName + "=" + cookieValue + "; expires =" + cookieExpires;
CookieExpires can be left unwritten. By default, the browser is disabled!
Then check if this cookie exists!
Reply

Use magic Report

0

Threads

73

Posts

27.00

Credits

Newbie

Rank: 1

Credits
27.00

 China

Post time: 2020-1-9 05:54:01
| Show all posts
It ’s better to use cookies,
When the page opens, check whether the cookie exists. If it does not exist, a pop-up window will be displayed.

When the pop-up window is unloaded from the body, clear this cookie. This way, if the pop-up window exists, it will no longer pop up. If it does not exist, it will pop up.
Reply

Use magic Report

0

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-1-10 08:36:01
| Show all posts
window.open (url, "newWinName", "")
---------------
Take a look at the description of the second parameter in the reference book
Reply

Use magic Report

0

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-1-10 09:09:01
| Show all posts
window.open (url, "newWinName", "")
---------------
Take a look at the description of the second parameter in the reference book
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list