473,586 Members | 2,718 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

"window.ope n" from selection WITH formatting

Currently I'm trying to make a plugin for my browser (Maxthon/IE6)
which allows me to select any text on the current page and press the
plugin button to create a new tab with the selection.

This will do the job:
<script language="JavaS cript">
javascript:r4NS y3m=document.se lection.createR ange();oDgs2Ke= r4NSy3m.text;dT 30FfN=new
Date();wdGs8c6= window.open('', 'w'+dT30FfN.get Time(),'');wdGs 8c6.document.wr ite(oDgs2Ke);
void(wdGs8c6.do cument.close())
</script>

Unfortunately, I want to retain the layout of the text and the above
code strips it out.
The code on http://www.webreference.com/js/colum...ssbrowser.html
seems to do precisely what I want but it displays the current selection
in a box on the page. I'm not interested in using 'onmouseup' as I want
to decide when the page should open.

Can someone please show me how to make the webreference example work in
a new page on demand.

Jul 23 '05 #1
2 1546


me*****@gmail.c om wrote:
Currently I'm trying to make a plugin for my browser (Maxthon/IE6)
which allows me to select any text on the current page and press the
plugin button to create a new tab with the selection.

This will do the job:
<script language="JavaS cript">
javascript:r4NS y3m=document.se lection.createR ange();oDgs2Ke= r4NSy3m.text;dT 30FfN=new
Date();wdGs8c6= window.open('', 'w'+dT30FfN.get Time(),'');wdGs 8c6.document.wr ite(oDgs2Ke);
void(wdGs8c6.do cument.close())
</script>

Unfortunately, I want to retain the layout of the text and the above
code strips it out.


var range = document.select ion.createRange ();
var html = range.htmlText;
var win = window.open('', 'w' + new Date().getTime( ));
win.document.op en();
win.document.wr ite(html);
win.document.cl ose();
void 0

is probably what you are after, put on one line in a javascript:
bookmark of course.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2
Beautiful - thank you so much.

Jul 23 '05 #3

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

Similar topics

3
3436
by: Shiperton Henethe | last post by:
Hi Can anyone tell me how to open up a new normal, full-sized browser window from a small popup window? I'm using something like this. <script language="javascript"> <!--
5
1541
by: Brandon Potter | last post by:
Forgive me if this has already been covered... I use dual displays and have 2 - 3 Visual Studio .NET 2003's open at the same time, however, without fail, at some point during my session, the title bar and border of one of the VS.NET's copies 1/2 of its height and 1/2 of its width, so I end up with this floating titlebar and border taking up...
3
2249
by: JohnEGee | last post by:
Hello, all, and TIA for any help you can offer. I've searched the Internet for answers and have finally come here. I've created a page (several, actually) with a link that opens a pop-up window. It's a pop-up window in the sense that it's smaller than the man page and is intended to be viewed and then closed. The problem is that if I...
5
3076
by: lindanr | last post by:
In ASP.NET 2005 I have an onblur="window.close()" javascript event in the <body> tag. When I click on the window's scrollbar, the window closes. The same code works fine in ASP.NET 2003. Any ideas?
1
5212
by: kbarrios | last post by:
Hi, I am working with VBScript and I put a "window.open" inside a "form action post" due that I am handing a "checkbox" on it, but the "window.open" doesn't work: <FORM ACTION="baz_add_action.asp" METHOD="post"> ...here go the Window.open script <INPUT NAME="add<%=p_prod_id%>" TYPE="checkbox" value="ON">
1
2804
by: R Reyes | last post by:
Hi, For some reason, the website I made does not open pages in a new page whenever I right-click "Open in New Tab" or "Open in New Window". But, as soon as I navigate to any other website, the open in new tab/window button works for them. Is there some setting I am missing that allows this to feature to work correctly? I don't have any...
4
3231
by: arajunk | last post by:
In Firefox this opens a full size window (maximized) . In IE it opens the partial window requiring user to click restore (upper right) to maximize. What am I missing ? var infoWindow=window.open('usgsMain.html','USGSwindow','status=no,resizable=yes,scrollbars=yes');
4
23262
by: jodleren | last post by:
Hi all I have a file I open in a smaller window, like this: <a href="#" onclick="window.open.... but it also causes the main window to jump to the top. What have people done to avoid that? BR
1
2258
gcoaster
by: gcoaster | last post by:
Hello, Access is accessing my patience! how does one filter just one form with a single combo box selection? I have a combo box named "cboCallStatus" unbound Row source type = Value List values; OPEN, CLOSED
0
7911
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...
0
7839
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8338
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...
1
7954
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...
0
8215
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...
1
5710
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...
0
3836
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...
1
2345
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
0
1179
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...

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.