473,659 Members | 2,662 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

opening a new window with HTML code instead of file

Hello,
I am searching for a cross-browser way (the most recent browsers
are fine) to use javascript to open a new window even though I do not
know the file I want to call. I do, however, know the HTML code I want
output in the new window. It would look like

<HTML>
<HEAD><TITLE>He llo</TITLE>
</HEAD>
<BODY>
Hello
</BODY>
</HTML>

I understand I could put this text into a file and call that, but if
there were a way to automatically populate the window with this code,
prior to opening it, that would be the ideal.

Thanks, - Dave

Aug 22 '05 #1
5 1893
la***********@z ipmail.com wrote:
Hello,
I am searching for a cross-browser way (the most recent browsers
are fine) to use javascript to open a new window even though I do not
know the file I want to call. I do, however, know the HTML code I want
output in the new window. It would look like


var newWin = window.open("ab out:blank");
newWin.document .open();
newWin.document .write("<body>S ome text</body>");
newWin.document .close();
newWin.document .title = "My favorite title";

See also perhaps the recent discussion at:
http://groups.google.co.uk/group/com...60664279d6460/

Csaba Gabor from Vienna

Aug 22 '05 #2
Thanks but sadly when I try this code on PC IE 6.0, I get a javascript
error that says "Access Denied".

Is there another way?

- Dave

Aug 23 '05 #3
<la***********@ zipmail.com> wrote in
Thanks but sadly when I try this code on PC IE 6.0, I get a javascript
error that says "Access Denied".

Is there another way?


http://www.htmlgoodies.com/primers/j...le.php/3478241

that any better?

Herc
--
too intelligent
See - you do get intelligent people on here! Kay. Well, there's you
and me and Herc.... the rest are a bit sus though
Dave Budd ~ UK Mensa founder

Aug 23 '05 #4

Csaba Gabor wrote:
la***********@z ipmail.com wrote:
Hello,
I am searching for a cross-browser way (the most recent browsers
are fine) to use javascript to open a new window even though I do not
know the file I want to call. I do, however, know the HTML code I want
output in the new window. It would look like


You would have to change the "about:blan k" to a "/" or something to get
the address bar to look right.

function javascripttest( )
{
var newWin = window.open("/");
newWin.document .open();
newWin.document .write("<body>M y virtual web page <BR> is what you
see!</body>");
newWin.document .title = "My virtual title";
newWin.document .close();
return;
}

http://www.askblax.com
var newWin = window.open("ab out:blank");
newWin.document .open();
newWin.document .write("<body>S ome text</body>");
newWin.document .close();
newWin.document .title = "My favorite title";

See also perhaps the recent discussion at:
http://groups.google.co.uk/group/com...60664279d6460/

Csaba Gabor from Vienna


Aug 23 '05 #5
la***********@z ipmail.com wrote:
Thanks but sadly when I try this code on PC IE 6.0, I get a javascript
error that says "Access Denied".


The popup blocker's stance is that it will only put up a popup on a
user initiated action. That means things like clicking on buttons,
etc. Unfortunately, IE/FF will not respond to popup attempts as a
result of a keyboard listener (document.onkey up = function() {...} )
even though it's pretty clear that pressing a ctrl+key is not an
accidental user action.

The code below now includes a button you may press.
Csaba Gabor
<button onclick="dome() " accesskey=d><u> D</u>o me
<script type='text/javascript'>
function dome() {
var newWin = window.open("ab out:blank");
newWin.document .open();
newWin.document .write("<body>S ome text</body>");
newWin.document .close();
newWin.document .title = "My favorite title";
}
</script>

Aug 23 '05 #6

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

Similar topics

2
4638
by: Jawahar Rajan | last post by:
All, I have a printer friendly page that is opened when a user clicks a link on my page to get the printer friendly version, How ever when they close out the printer friendly version and return to the original page the mouse cursor is a Hour glass shape! my code: I use DIV tag <DIV id ="printThis"> <%
3
1706
by: Display Name | last post by:
When this form's being submitted, two windows are opening instead of only one here is the function I'm using: function subForm(){ //insert form validation here //if form is valid, open a pop-window & submit subWin = window.open("http://www.smoochya.com/books.html","subWin","width=550,height= 350,address=no")
14
11074
by: D. Alvarado | last post by:
Hello, I am trying to open a window containing an image and I would like the image to be flush against the window -- i.e. have no padding or border. Can I make this happen with a single call to a window.open function? I would prefer not to create a separate HTML page. So far all I have is the basic var cwin = window.open('images/KJV-THANKS.gif', 'Thanks', 'width=243,height=420,'); cwin.focus();
2
2087
by: Matt Hamilton | last post by:
I have an application page with a datagrid with a checkbox on each row. The user should check the rows they want to modify and then click a button. When the button is clicked, I have a Click handler that builds a url and then registers a startup script to open a modal dialog window. With XP SP2 installed the pop-up blocker stops the windows from displaying. Is there any way around this? My users are too stupid to turn off the popup blocker...
5
12291
by: Neil Rossi | last post by:
I have an issue with a particular ASP page on two web servers. Let's call these servers Dev1 and Beta1. Both Servers are running IIS 5, Windows 2000 SP4 with "almost" all of the latest patches. On Beta1, I am able to execute a particular page with no problem, that page opens up in the comes up just fine. On Win2kdev1, when I go to execute the same page, it opens a file download dialog and asks me whether I want to open or save the...
26
2979
by: Nospam | last post by:
I am trying to open a link in a new template window : <a onclick="windowopen('example.html','example');return false;" href="http://www.example.com" target="_blank"example link</a> such that clicking on the example link will open it in a new window in an already saved template/site/ called example.html
2
8322
by: Oliver Wong | last post by:
I'm trying to have the "submit" button of a form open a new window which loads a PDF, and also to redirect the window containing the submit button to a new location. Here's a small HTML file demonstrating my code: <html> <body> <input type="button" onclick="window.open('http://www.cs.ubc.ca/~lowe/papers/ijcv04.pdf'); window.location = 'http://www.google.ca/';"/> </body>
3
10240
by: Andrew Poulos | last post by:
There's a HTA application that's running on a local computer (not from a URL) and the user can open a new HTML window by clicking a button The first time the user clicks the button the window opens. Any subsequent click causes this dialog, with this error, to appear: "Error: The remote server machine does not exist or is unavailable" The relevant code is
0
2018
by: bbrewder | last post by:
I am struggling with some MSAccess automation issues. Basically, we have a .Net application that uses MSAccess for reporting (legacy code). We are able to launch MSAccess fine and even work with the MSAccess COM objects to run our reports (using GetObject(<MDB Path>) - see http://support.microsoft.com/default.aspx?scid=kb;en-us;317113&Product=vbNET for info on how to do this). The problem that we are running into is that if our Access...
0
8427
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
8850
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
8746
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...
0
8626
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...
0
7355
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6178
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
5649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
1975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1737
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.