/    Sign up×
Community /Pin to ProfileBookmark

window.open window not displaying

I’m executing a function on onclientclick.

var newwindow;
function GetUrlPage() {

var pplid = document.getElementById(‘<%= tbPersonId.ClientID %>’).value;

newwindow = window.open(‘MXUrl.aspx?PersonId=’ + pplid, null,
“Width=475px, Height=500px; top=42px; scrollbars=1; toolbar=0; titlebar=0; menubar=0; statusBlush | :O ;”);

Nothing happens. If I add an alert(“some message”); after the window.open everything works great.
I can only assume it is just blowing thru the code but I don’t know how to make it wait.

Don’t do much in javascript so am really at a loss. Really appreciate any help you can give me.

to post a comment
JavaScript

7 Comments(s)

Copy linkTweet thisAlerts:
@cootheadAug 28.2020 — Hi there rick0127,

I believe that most browsers block pop-up windows by default.

[i]coothead[/i]
Copy linkTweet thisAlerts:
@rick0127authorAug 28.2020 —  Thanks for the reply. I have other pop-ups that are working fine.

I changed from window.open to Response.Redirect which works. Don't know why, not what I want to do but the only solution I could find. I would really like to know why.


thanks
Copy linkTweet thisAlerts:
@SempervivumAug 29.2020 — @rick0127#1622707 I have other pop-ups that are working fine. ... I would really like to know why.[/quote]I suspect the reason is that the browsers block popups by window.open only when they are not initiated by user action. If they are they work fine. I verified this in my browser (Opera).
Copy linkTweet thisAlerts:
@VITSUSAAug 29.2020 — @rick0127#1622703 I agree with coothead, most browsers block pop-up windows by default, otherwise, you can :)
Copy linkTweet thisAlerts:
@rick0127authorAug 29.2020 — Sounds logical. Do you guys have any idea on why it works correctly when I add an 'alert' after the window,open? I don't understand how that changes things.
Copy linkTweet thisAlerts:
@daveyerwinAug 29.2020 — @rick0127#1622738 said ...

any idea on why it works correctly when I add an 'alert' after the window,open

- - - - -
yes

when things work after an alert it is a classic

symptom of a timing problem

set a time out before trying to access the new window

or even much better have a javascript to call from the

new window back to the original window

make this call from the last line of the new window

call the function that access the new window

just a guess but it is a problem I have solved

in the past with this method
Copy linkTweet thisAlerts:
@rick0127authorAug 30.2020 — A timing problem really make sense to me but I not sure if I understand how to "have a javascript to call from the

new window back to the original window". Like I said early I really don't do much in Javascript so it's probably just a lack of knowledge on my part.



×

Success!

Help @rick0127 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.26,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...