473,746 Members | 2,717 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Creating popup using DOM and *no* html src


Hi all,

I have a web app with a popup window for entering data. I don't want
to access the web every time this window is opened, as most of the app
is AJAX. But I can't figure out how to open a new window and build it
with DOM rather than having to provide a src. Even a blank.html as src
takes time to fetch.

How can I create a popup and dynamically add DOM content without any
html at all?

Aug 10 '05 #1
24 3258
jonathon wrote:
How can I create a popup and dynamically add DOM content without any
html at all?


Unfortunately, you can't. When you open a window, it must have a url.

A work-around is to use the url of "about:blan k", but this causes security
warnings on secure sites, and doesn't work in some browsers. You can use a
javascript: pseudo-protocol to write out dummy content, but this also throws
up security warnings in some cases. You can leave a blank url, but only some
browsers prefer this over about:blank.

This is, IMO, unfortunate. There should be a cross-browser way to pop up a
new window and fill it with content without any security issues or problems.

If anyone knows of a solution, I would _love_ to know it.

--
Matt Kruse
http://www.JavascriptToolbox.com
http://www.AjaxToolbox.com
Aug 11 '05 #2
I am not familiar with ajax, so I don't know if this is a plausible
solution:

But the only other idea I would be able to think of is to actually make
the "popup" as content inside a div element which is hidden. Then on
some event you make it visible, and using z-index style you can then
position it above the other content.
I don't know if this is an acceptable avenue to venture down, but it
would be a possible way to mimic a "popup" without actually having to
supply an url for a window.open();

Aug 11 '05 #3

Matt Kruse wrote:
jonathon wrote:
How can I create a popup and dynamically add DOM content without any
html at all?


Unfortunately, you can't. When you open a window, it must have a url.


Actually, I found a site where you can do this.

http://oit.wvu.edu/support/training/...OM/calvin.html

The 'Reader()' function opens a popup without any src and write()'s
content as a string to the new window. But my window is just a bit
more complex than this one, and doesn't lend itself to this approach.
Especially since it uses iframes.

Aug 11 '05 #4

Xandax wrote:
I am not familiar with ajax, so I don't know if this is a plausible
solution:

But the only other idea I would be able to think of is to actually make
the "popup" as content inside a div element which is hidden. Then on
some event you make it visible, and using z-index style you can then
position it above the other content.


That's a possibility. A very good one, actually. I prefer the windows
that seem to be part of the page rather than entirely separate anyway.
I'll give that a shot.

Aug 11 '05 #5
jonathon wrote:
Actually, I found a site where you can do this.
http://oit.wvu.edu/support/training/...OM/calvin.html


This just passes an empty string as the url. This won't work in some
browsers.

--
Matt Kruse
http://www.JavascriptToolbox.com
http://www.AjaxToolbox.com
Aug 11 '05 #6
Matt Kruse wrote :
jonathon wrote:
How can I create a popup and dynamically add DOM content without any
html at all?

Unfortunately, you can't.


Well, I disagree. E.g.:

Create a sub-window and dynamically DOM-insert an image
http://www.gtalbot.org/DHTMLSection/...geInPopup.html
When you open a window, it must have a url.

A work-around is to use the url of "about:blan k", but this causes security
warnings on secure sites, and doesn't work in some browsers.
It should not work on all browsers which apply correctly the
cross-domain script security restrictions:
http://www.mozilla.org/projects/secu...me-origin.html
also explained at
http://developer.mozilla.org/en/docs...indow.open#FAQ
You can use a
javascript: pseudo-protocol to write out dummy content, but this also throws
up security warnings in some cases. You can leave a blank url, but only some
browsers prefer this over about:blank.

Again, about:blank is an unique domain name...
This is, IMO, unfortunate. There should be a cross-browser way to pop up a
new window and fill it with content without any security issues or problems.


Well, yes, there is.

Gérard
--
remove blah to email me
Aug 12 '05 #7
Xandax wrote :
I am not familiar with ajax, so I don't know if this is a plausible
solution:

But the only other idea I would be able to think of is to actually make
the "popup" as content inside a div element which is hidden. Then on
some event you make it visible, and using z-index style you can then
position it above the other content.

http://www.netscape.com/
does almost that on a load event. The What's new box moves into the
viewport for 10 sec. or so and then moves back into a negative top value.
Click the yellow "What's new" button if you want to see it in action again..

I don't know if this is an acceptable avenue to venture down, but it
would be a possible way to mimic a "popup" without actually having to
supply an url for a window.open();


Yeah, but it's as annoying as a popup actually. It's still the same too:
unrequested content popping up, popping in the browser viewport.
Netscape DevEdge had a article on how to bypass unrequested popups and
Netscape was among the first to use it. It's sooooo stupid!

Gérard
--
remove blah to email me
Aug 12 '05 #8
Gérard Talbot wrote:
Unfortunately, you can't.

Well, I disagree. E.g.:
Create a sub-window and dynamically DOM-insert an image
http://www.gtalbot.org/DHTMLSection/...geInPopup.html


This example doesn't demonstrate your (incorrect) point.
It opens a file called "PopupWindowOnl yImage.html" when it does window.open.
It doesn't open a "blank" window with no contents.
This is, IMO, unfortunate. There should be a cross-browser way to
pop up a new window and fill it with content without any security
issues or problems.

Well, yes, there is.


Try again :)

--
Matt Kruse
http://www.JavascriptToolbox.com
http://www.AjaxToolbox.com
Aug 12 '05 #9
Gérard Talbot wrote:
Xandax wrote :
But the only other idea I would be able to think of is to actually make
the "popup" as content inside a div element which is hidden. Then on
some event you make it visible, and using z-index style you can then
position it above the other content.

http://subimage.com/sublog/subModal
Yeah, but it's as annoying as a popup actually. It's still the same too:
unrequested content popping up, popping in the browser viewport.
Netscape DevEdge had a article on how to bypass unrequested popups and
Netscape was among the first to use it. It's sooooo stupid!


But having given the link, I agree with Gérard. These divs
implementing popups are a real annoyance because they cover content and
you cannot be sure when you click on them what they will do (I'm
thinking specifically of news sites that pop up one of these ads that
cover content). Even if they eventually become well implemented to the
point of having a nice fake title bar, and are draggable, etc. they
will still make me suspicious because I don't know their standard
functionality. That means, that a click on a good looking fake popup
might actually be license for a real popup to be popped up. By the
way, I just had a thought... since popup blockers generally don't block
popups from user initiated actions, can you (a) accumulate a bunch of
popups just based on a single action like a click (since it's actually
a mouse down, mouse up, mouse click)? (b) delay the actual popping
(sort of save up your popup popping credits and spew them all out at
the end - possibly in conjunction with window.setTimeo ut)?. As opposed
to another poster, I WANT to be able to move a popup so that it doesn't
cover the parent window so I can read the entire parent window. The
upshot: in general, I recommend against this route.

Csaba Gabor from Vienna

Aug 12 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3973
by: Obantec Support | last post by:
Hi i leached some code and strung together a popup i need for a page with 5 help buttons. Now i could use 5 scripts and pre-load the values but i would rather get a better understanding of how to pass some extra values to 1 script. 1. <SCRIPT LANGUAGE="Javascript"><!-- function popUp(url) {
38
5085
by: Shaun McKinnon | last post by:
HI...Here's my problem...I have a popup window that loads when i want it to, but it's not sized properly. I've set the size, but it doesn't seem to work. I've been on 8 different websites to find out what i'm doing wrong, and so far it seems i'm doing it the right way. Here's my code...any suggestions would be appreciated. <script language="javascript"> <!-- window.open("256fx/index.htm", "", "height=400, width=600"); //-->
12
12431
by: HarveyB | last post by:
I would like to generate non-modal popup windows from ASP.Net code-behind. I have tried using Client Side scripting like "function Test(){ window.open('test.htm',_blank, 'height=200,width=400,status=no,toolbar=no, menubar=no,location=no resizable=no scrollable=no'); but I can't seem to invoke the client side script from within a Server Side Form. I know I can use the context with to Response.redirect or Server.transfer to return a
2
1713
by: Logger | last post by:
Help! I’m trying to get popups to work in asp.net. I’m Using the following javascript code in a sub, but I can’t get the PopupWindow to work. At first I thought the routine wasn’t working but it is. It looks like it’s the window.open that’s not working. I have site popup allowed turned on, if I replace window.open with alert it works, if I put the code in the html code it works. Any suggestions? Dim PopupScript As String...
15
18742
by: | last post by:
So many websites can get around my Googlebar's popup blockers. Even Opera 8 can not stop those popups. I looked into the codes, and I can find nothing showing me how it is done. Can anyone help me find what how it is done? First go to http://www.sitepoint.com/forums/showthread.php?t=184025&page=1&pp=25 Click on Last ? on the page
15
2834
by: David Thielen | last post by:
Hi; My ASP.NET app (C# calling J# under .net 2.0) creates a png file in a subdirectory to display as part of the created page. However, the bitmap will not display due to a security violation. Everything is the default settings I believe. IIS is running under Local System. In IIS the DefaultAppPool is running under Network Service. Annonymous access uses the account IUSR_JASMINE (machine name is Jasmine).
1
5284
by: XP | last post by:
Hello Everyone, I was stuck with this really frustrating problem for sometime. Let me explain what I am trying to achieve: There is a form and an inner iframe. The form's target is set to the iframe so that when the form is submitted, the page does not get reloaded/changed ( as the iframe would be the one getting refreshed. The Iframe is set to have 0 width and height to make it look invisible ). I have a copied the html source ( at...
2
3265
by: wreed06 | last post by:
Hello, I have 2 problems. In my webpage, I have a dropdown list with a button that takes the user to a popup window specific to the option. I am using Firefox 2.0.0.13. I have successfully validated my HTML and CSS code. 1. When I clear cache and refresh my webpage, it takes 3 tries before the popup window displays - I click on the button once, a white window the size of my webpage displays. I close it and click on the button again (for...
11
5319
by: V S Rawat | last post by:
using Javascript, I am opening a web-based url in a popup window. MyWin1=Window.Open(url, "mywindow") There is a form (form1) in the url in that popup window, I need to submit that form. How do I submit that form1 from the javascript from my current window? Thanks.
0
8974
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9500
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9349
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9285
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9218
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6772
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4575
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3292
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2199
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.