Printing through Window.Print() in Google Chrome may cause interruptions in other open tabs

Currently, I am troubleshooting a printing issue on an ASPx Web Forms Page.

I have a 'Print' button that triggers the following event (print method):

private void MenuPrint_ItemClick(object sender, DevExpress.Web.ASPxMenu.MenuItemEventArgs e)
        {
Response.RedirectOn("Print.aspx", "_blank", "menubar=0,scrollbars=1,width=780,height=900,top=10");
        }

Upon clicking the 'Print' button, a new window 'Print.aspx' opens. Here is what is contained on this page:

protected void Page_Init(object sender, EventArgs e)
        {
            LoadData(); // generate print document
            Response.Write("<script language=javascript>window.print();</script>");
        }

However, there is a problem:

The window.print() function opens the Google Chrome printing menu, which blocks the old window where the 'Print' button is located.

When I close Print.aspx by clicking [X], List.aspx window remains blocked. If I click 'Anuluj' (which means Cancel) and then close List.aspx, it functions properly without any blocks.

After some investigation, I found that there are no other options to print the document, nor can I handle the 'Cancel printing' button.

My question is how can I prevent this blocking issue. Should I use something other than RedirectOn?

Answer №1

It appears that there might be a glitch in Chrome 34 - are you currently using this version of Chrome? I found a related inquiry here: Javascript window.print() issue in Chrome where new window/tab closes instead of canceling print which leads to blocked javascript in parent window. Unfortunately, no resolution has been discovered yet.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

How to use React hooks to flip an array

Is it possible to efficiently swap two items in an array using JavaScript? If we are dealing with a boolean, one could achieve this by: const [isTrue, setIsTrue] = useState(false); setIsTrue(!isTrue); However, what if we have an array? // Let's ...

Switching the data center with WTelegramClient

With the WTelegramClient library, what is the best way to access the list of available Telegram data centers and switch to a different one? To learn more about Telegram API data center descriptions, visit: ...

Initiate the execution of JavaScript functions in the loaded partial view using Ajax

I am currently working with a javaScript function that loads a partial view within my page's layout using the following logic: $('.follow-tasks').click(function (e) { e.preventDefault(); var $followtaskList = $("#td-" + $(this).attr ...

What is the best way to link a style attribute to a template property?

I am in the process of developing a unique style for a slider and my goal is to be able to modify the red color by adjusting the Background property of the slider. https://i.sstatic.net/t3Kuq.png Currently, I am hardcoding the value for setting the style ...

Setting up Karma configuration to specifically exclude nested directories

When unit testing my Angular 2 application using Karma, I encountered an issue with my directory structure: └── src/ ├── index.js ├── index.js.text ├── index.test.js ├── README.txt ├── startuptest.js ...

Tips for controlling HTML elements using JavaScript

I'm currently working on implementing a mouse-over scale effect for an HTML image. I chose to use JavaScript for this task because I need the ability to manipulate multiple elements in different ways simply by hovering over one element. Below is the J ...

Issues with the PhoneGap app's InAppBrowser functionality

I've been working tirelessly on this project for several days, but have hit a roadblock and need some assistance. My goal is to open a PDF file sourced from a Dropbox account using JavaScript. The code works perfectly fine when uploaded through PhoneG ...

What is the best way to design a drop-down suggestion list similar to Google's?

This question is still in the theoretical stage, but it's something I'm definitely considering for the long run. When you visit google.com and type in a search query, the site provides suggestions in a dropdown menu. I'm pretty sure they use ...

CKEditor - extracting modified content with its associated HTML markup

I am currently developing my own custom Drupal plugin and I recently reviewed the code provided in the API for change events: editor.on('change', function (evt) { console.log(this.getData()); }); Using this code snippet, I am able to vi ...

Looking to incorporate content from an external website onto my own site

I have experimented with various types of HTML tags such as iframe, embed, and object to display external websites. Some of them load successfully, while others do not. After researching my issue on Google, I discovered that "For security reasons, some si ...

A method to eliminate click events for an element

I have a unique element called #foo with a click event attached to it. This element is nested within another element called #bar, which also has a separate click event attached to it. <div id="bar"> <div id="foo" /> </div> Currently, ...

Enabling Cross-Origin Resource Sharing (CORS) for Tomcat REST API

Recently, I set up a local Tomcat installation on port 8081 to expose a REST API. However, my development web server operates on port 9000. I want to make calls to the REST API from JavaScript code running in the browser using Angular's $http. Due to ...

Retrieving precise information from a Json file with PHP

Hey there, I have a JSON file and I'm looking to extract certain data from it. Here's how the file appears: { "took" : 1, "timed_out" : false, "_shards" : { "total" : 1, "successful" : 1, "skipped" : 0, "failed" : 0 }, ...

Remember to properly initialize the scalar variable when working with a gridview in C# asp.net

<asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1" AutoGenerateColumns="False" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" OnRowCommand="GridView1_RowCommand"> <Columns> <asp:Tem ...

Consolidate the indexes of arrays into a single object

Is there a way to combine array indexes into one object using a key-value pair format, like {authors[i]: quotes[i]} in my example? If you'd like to review the code, please visit my Codepen: http://codepen.io/anon/pen/Ndezeo Thank you. ...

Increase the object using JavaScript

I currently have an object collection: var obj = { ref01:{ test:"abc" }, ref02:{ test:"xyz" }, ref03:{ test:"pqr" } } and I also have a new object: const test = { test:"def" } My goal is to update the existin ...

Display the div only when the time variable reaches zero

I want to display a div when the difference between the time imported from the database and the current time is 0. How can I achieve this? Here is the code snippet: while ($row = mysqli_fetch_array($result)) { echo "<div class='alert' id= ...

Processing background tasks in parallel using ASP .Net Core's queuing system

I've implemented an ASP .NET core Web API that utilizes Queued background tasks as outlined in the tutorial provided here. Following the code sample and instructions in the article, I've integrated IBackgroundTaskQueue, BackgroundTaskQueue, and ...

Determine if a webpage is out of focus using jQuery

Is it possible for jQuery/JavaScript to detect if a user is engaged in other activities and not currently looking at this page? Precision is not necessary, just an approximate idea is fine. ...

Is there a method to send a FontAwesomeIcon component as a prop to the ReactHTMLTableToExcel component?

When using ReactHTMLTableToExcel, you can set the prop buttonText as a String, <ReactHTMLTableToExcel id="test-table-xls-button" className="download-table-xls-button" table="table-to-xls" ...