HomeОбразованиеRelated VideosMore From: kudvenkat

JavaScript popup window

392 ratings | 141039 views
Link for all dot net and sql server video tutorial playlists http://www.youtube.com/user/kudvenkat/playlists Link for slides, code samples and text version of the video http://csharp-video-tutorials.blogspot.com/2015/01/javascript-popup-window_22.html In this video we will discuss, how to open a popup window using JavaScript. To open a popup window, use window.open() method. All the parameters are optional. window.open(URL, name, features, replace) URL - URL of the page to open. If URL is not specified, a new window with about:blank is opened name - Specifies the target attribute or the name of the window. _blank - URL is loaded into a new window. This is the default value if not specified. _parent - URL is loaded into the parent frame _self - URL replaces the current page _top - URL replaces any framesets that may be loaded name - name of the window features - Must be a comma-separated list. Some of the browsers does not support these features. menubar (yes/no) - Shows or hides the browser menu toolbar (yes/no) - Shows or hides the browser navigation bar location (yes/no) - Shows or hides the address field status (yes/no) - Shows or hides the status bar resizable (yes/no) - Whether or not the window is resizable scrollbars (yes/no) - Whether or not to display scroll bars top(pixels) - The top position of the window left(pixels) - The left position of the window height (pixels) - The height of the new window width (pixels) - The width of the new window replace - Specifies whether the URL creates a new entry or replaces the current entry in the browser history. Works only if the url is loaded into the same window. true - URL replaces the current document in the browser history list false - URL creates a new entry in the browser history list No parameters are passed to window.open() method. Since URL is not specified, a new window with about:blank will be opened. [input type="button" value="Open popup" onclick="window.open()" /] Most modern browsers open new tabs instead of separate windows. If you want to open the popup in a new window, one workaround I have found is to specify the URL, name, and features(height and width) parameters. This may not work in all browsers and it also depends on user's browser preferences. [input type="button" value="Open popup" onclick="window.open('http://google.com', '_blank', 'height=200,width=200')" /] When name parameter is set to _self, the new window replaces the current window [input type="button" value="Open popup" onclick="window.open('http://google.com', '_self')" /] Specify where you want the new popup window to be positioned using top and left features. [input type="button" value="Open popup" onclick="window.open('http://google.com', 'My Window', 'height=300,width=300, top=400, left=400')" /] Disable scrollbars and resizing. Works in IE but not in Chrome. [input type="button" value="Open popup" onclick="window.open('http://google.com', 'My Window', 'height=300,width=300, scrollbars=no, resizable=no')" /] To close pouup use window.close() method. [input type="button" value="Open popup" onclick="openPopup()" /] [input type="button" value="Close popup" onclick="closePopup()" /] [script type="text/javascript"] var popup; function openPopup() { popup = window.open("http://google.com","My Window", "height=300,width=300") } function closePopup() { popup.close(); } [/script]
Html code for embedding videos on your blog
Text Comments (54)
tripti gupta (1 month ago)
indow.open('https://www.linkedin.com/uas/oauth2/authorization?response_type=code&client_id=75k3gdbsqbrx1i&scope=r_basicprofile&state=dvchdv&redirect_uri=https://com.mentorz.linkedin.oauth/oauth' I am using above code to open linkedLogin in new popup , Once its done I sign in and popup window gets redirect to the Url given as Value of redirect_uri in above Url like this:- https://com.mentorz.linkedin.oauth/oauth?code=AQROGHDdSmrdxU7VQB19039w26o0LLtGy0eLnsxlSLSAk2p3sVGj4qhOql2rcw5KXTfMHf8I1I4Ar-K6esxI5l5rTTgkVNSV9DshbuvJEjWt2uYEnfPtEwDJ9Ie98ls0Cyk103CUjq235_8tDzUSsMd7QHs3RmSM4y2G4Ht2K1enfl8XZ2y_e0HvRes-4w&state=dvchdv I need to capture this AccessToken code={} in Parent window Please tell me how to do this Thanks
ravi shankar Sharda (5 months ago)
sir please make play list javascript and jquery also thanks
kudvenkat (5 months ago)
Hello Ravi - We already have JavaScript and jQuery playlists. I have included the links for you below JavaScript Tutorial https://www.youtube.com/playlist?list=PL6n9fhu94yhUA99nOsJkKXBqokT3MBK0b jQuery Tutorial https://www.youtube.com/playlist?list=PL6n9fhu94yhVDV697uvHpavA3K_eWGQap You can find all our playlists at the following link https://www.youtube.com/user/kudvenkat/playlists?sort=dd&view=1
Quang Nguyễn Minh (6 months ago)
Abhishek Bhakare (7 months ago)
scrollbar=no, resizable=no : this does not work not only in Google Chrome but also in Microsoft Edge and Mozilla Firefox. (i.e. It works only in Internet Explorer).
the anh nguyen (8 months ago)
How do we 100% hidden the url?
Somnath Roy (8 months ago)
Sir i want to sees videos on popup how can does it??
heena bhaskar (8 months ago)
How we set timing in popup? ?plz reply..
Jonathan Hammond (9 months ago)
Very interesting! I am trying to open the video on the same page however, not in a new window or tab. I am actually trying to open up in a different box, but this is still closer than what I had before thank you.
Rashmi Singh (9 months ago)
how to bind pop up's data into mail page text box's like if i select 'A' from pop up which is define in li (list), how it will come into main page textbox??
Unique Tutorial (10 months ago)
helllo dear i want a button that i have i created but i want when i click the button then it open a popup of inquiry form.. can u ??
Sreedhar Reddy (4 months ago)
How to stop moving popup on browse screen.. It should freeze.
Timothy Meyer (10 months ago)
What was the point of the 'var = myWindow' would it have still run wihout that?
pastuh (6 months ago)
var myWindow was Global variable. After that all functions can reach this variable. (Watch all tutorials)
siddhartha tyagi (10 months ago)
When page load pop-up should come after 2 min not instant and appear after every 1min until form doesn't fill.
The Great Cheater (1 year ago)
Tq I m crying with joy somebody stop me
Madan Chakravarthy (9 months ago)
Please dont stop..Keep Enjoying
The Kushwaha Laundry (1 year ago)
kala srujana (1 year ago)
popup.close() is not working..Any work around for this?
C SC (1 year ago)
How to create a any website popup with auto closed
umesh belge (1 year ago)
Thanks for your guidance. i have one question and i.e how to minimize window by scripting ? like close.... Could you please let me know ?
Ali Hashim (1 year ago)
Hi , Can you please explain how can I open popup to play video   by click on image in datalist by using asp.net and jquery . thank you
VTKgames (1 year ago)
Is this harmful? xD
Queena Zhang (2 years ago)
As you can see, the popup window is not responsive. How can you make it responsive??
Chandana Don (2 years ago)
Hi there i need to have child window on the left while i still use parent window entries and still child window to be top left without dissaprearing, please let me know the script. thank you
Kevin DeLaune (2 years ago)
Would your function hold multiple popups? Meaning, if I wanted to use openpopup() for many popups to hold different information for each popup; could that be done? Example: Button 1: pops up a window and "holds certain information" Button 2: pops up a window and "holds yet different information" Button 3: pops up a window and yet again, "holds different information"
Riu Rock (2 years ago)
many thanks for the video
Raphael Bernard (2 years ago)
Works in Chrome and not in IE? I think you ment?
ConaxHGG (2 years ago)
Hello Venkat, is there anyway to make the popup modal?
bra scene (2 years ago)
Thank you very much! Great as always!
Trần Tiến Công (2 years ago)
Hi kudvencat i have a problem with html template same zopim! i want to code like picture. When i click to link id: [IMG]http://i1035.photobucket.com/albums/a436/someone8989/Screen%20Shot%202016-07-06%20at%2011.17.50%20PM.png[/IMG] then open popup (i don't know how) [IMG]http://i1035.photobucket.com/albums/a436/someone8989/Screen%20Shot%202016-07-06%20at%2011.17.59%20PM.png[/IMG] and: url will be show... [IMG]http://i1035.photobucket.com/albums/a436/someone8989/Screen%20Shot%202016-07-06%20at%2011.18.35%20PM.png[/IMG] Pls help me!
Amala Gopan (2 years ago)
Hi, can you please explain how to disable the address bar in pop up window using Java script. I have tried with location=0 attribute. but its not working in IE. Please explain how to
gurveer singh (4 months ago)
Did U get How To That If Yes Please Share
Hitesh Bhavsar (3 years ago)
thank you kudvenkat
Web Tasarımcılar (3 years ago)
kudvenkat (3 years ago)
+Web Tasarımcılar Thank you for the feedback. This means a lot. Very pleased you found these videos useful. Dot Net & SQL Server training videos to help you become a web developer https://www.youtube.com/user/kudvenkat/playlists?view=1&sort=dd Download videos for offline viewing http://www.pragimtech.com/Order.aspx Slides, Code Samples & Text Version of the videos can be found on my blog http://csharp-video-tutorials.blogspot.com Tips to effectively use our youtube channel https://www.youtube.com/watch?v=y780MwhY70s To receive alerts, when new videos are uploaded, please subscribe to our channel http://www.youtube.com/subscription_center?add_user=kudvenkat If you like these videos, please click on the THUMBS UP button below the video May I request you to please share the link with your friends who you think would also benefit from them To teach is to learn Thanks Venkat
Pablo Calderón (3 years ago)
Hey +kudvenkat  I have some issues with my popup. When it opens, is in the center top of the screen, and I want it in the middle of the screen. Also It's not working the Rezisable attribute. I'm always using chrome.
ib kanpak (3 years ago)
Asif Khan (3 years ago)
so deep understanding of knowledge.I wonder how..
himanshu (10 months ago)
keep wondering
Asif Khan (3 years ago)
hello +kudvenkat ..hey nice explaination. you are from Uk..
Dipendra Shekhawat (3 years ago)
+kudvenkat I want to implement a function similar to window.open(). Can you please help me with this ? http://stackoverflow.com/questions/30533326/impementation-of-optional-parameters-in-javascript
foggymedia (3 years ago)
great video! Can I ask how someone could activate the pop up window from just plain text on the webpage rather then from a button?
Your Cool Tool (3 years ago)
Kudvenkat ..what if I want to put image not open popup word then what coding I need to use? any help?
Necro Gamer (4 years ago)
i was so sure you were maybe russian or something, but when i saw google redirecting to co.uk i was kinda astonished! heheh! anyway thank you for this informational video. i love it <3
Faizan Akram Dar (3 years ago)
+Necro Gamer He is an Indian but has worked in UK for many years as a software architect
ThaVrisco (3 years ago)
+Necro Gamer He just lives in the UK.
mahipal kamanchi (4 years ago)
Thank u sir
Mujeeb Rehman (4 years ago)
I searched many times for popup stuffs nd sir u are great..u explained us so well thanks sir u are awesome
rob hype (4 years ago)
great tutorial as usual
Raviteja Aulaparthy (4 years ago)
Thank u sir
shanthe Kumare (4 years ago)
Thank you sir for  such a great and clear video 
krutomjer (4 years ago)
Peter L (4 years ago)
Very informative. Thank you

Would you like to comment?

Join YouTube for a free account, or sign in if you are already a member.