In JavaScript, what is the maximum length permitted for the window.returnValue property?

When using window.returnValue (variant) in a modal, is there a maximum length restriction to be aware of?

I have a setup where I call a modal window utilizing showModalDialog() and then retrieve a comma-separated string as a result. This string represents a selection of users that are then added to a StringBuilder for display within a literal.

Dim strReturn As New StringBuilder
strReturn.Append("<script type=""text/javascript"">window.returnValue='")
Dim strUsers As New StringBuilder
For Each dtRow As DataRow In GetSelectedUserTable.Rows
    If strUsers.ToString.Length > 0 Then
        strUsers.Append(",")
    End If
    strUsers.Append(dtRow("UserID"))
Next
strReturn.Append(strUsers.ToString)
strReturn.Append("';window.close();</script>")
litReturnJavascript.Text = strReturn.ToString

In this scenario, is there a maximum limit on the number of characters that can be included in the window.returnValue?

Answer №1

Which browser are you experiencing difficulties with? It is worth noting that window.returnValue may not be supported in Firefox, and possibly not in other browsers as well.

Additionally, have you checked the content of strUsers after constructing it to ensure there are no single or double quotes within the string?

I assume that the maximum size/length of that property would be more dependent on your system's memory capacity than anything else.


UPDATE: Consider using window.open() to launch a new window and window.opener to set the value on the parent form instead - this method is supported by a wider range of browsers. Just a suggestion...

Answer №2

JasonBunting's idea is quite effective. By ensuring that the modal dialog updates the parent before closing, you can easily transfer objects between windows without being constrained by the return value limitation. One way to achieve this is to incorporate a hidden field on the parent window and update it with the desired return values.

Answer №3

Due to the requirement to support IE6 (not by choice), I have implemented showModalDialog for the modal functionality.

The strUsers variable is expected to contain a list of integers separated by commas.

Example: 384834,583882,343993,391823,302103

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

Ways to stop VoiceOver from selecting the background content when a modal is open

Is there a way to prevent VoiceOver from reading the content behind a modal? I tried using aria-modal=true, but it seems VoiceOver does not support this feature by default like NVDA and JAWS do. I found more information about this on . According to the in ...

Verifying the Redux saga test plan's functionality by testing a reducer with a specific state branch

I'm facing some challenges in properly testing my saga. The issue arises because when the saga is running, the reducer is mounted at state: {...initialState}, while my saga select effects expect the reducer to be mounted at state: {authentication: {.. ...

The value entered is not within the acceptable range and

Every time I attempt to use pagedlist in my controller, I encounter the following error: An exception of type System.ArgumentOutOfRangeException was thrown with the message PageNumber cannot be below 1. Parameter name: pageNumber Actual value was 0. ...

Attempting to execute a bind function within a directive that is isolated in its own scope

Why is the functionality not working as expected? index.html <div ng-controller="mainController"> <sun external-fct="changeValue(internalValue)"></sun> </div> controllers.js controllers.controller('mainController', ...

ASP.NET user control cannot locate hidden field

In an asp.net usercontrol (.ascx) that contains an HTML hidden field, there are some issues to address. <input id="HiddenField1" type="hidden" runat="server" /> When the user control triggers a HTML pop-up window, users input values which are then ...

Leveraging nodemailer for automated email delivery

Hey there! I'm looking for some advice on how to set up scheduling with emailing using nodemailer. Ideally, I'd love to be able to schedule emails to send every day at 9am within a web app using nodemailer. However, I'm not sure where to st ...

Maintaining the generic types in mapped types in TypeScript

In my current project, I have a unique design where a class contains instance methods that act as handlers, each representing a specific operation. These handlers take a reference as input and assign the output to a second parameter. To simplify this proce ...

Selection auto-closing feature

I am currently working on a button that generates a dropdown menu with various categories to choose from. I would like the dropdown to automatically close when I click outside of it, similar to how a lightbox or modal popup works on a webpage. Currently, I ...

Using Array Data Format to Customize Color in Highcharts Funnel Chart

I have included the funnel visualization code that I've been working on. $(function() { var dataEx = [ ['1 Visit', 352000], ['2 Visits', 88000], ['3+ Visits', 42000] ], len = dataEx.length, ...

Received an error due to an invalid argument: the value of '0' is not valid for the parameter named 'SelectedIndex'

When the Label.text is set to "ad", how can I filter the display of my combobox to only show items in the database that contain "ad", rather than displaying all items? However, I keep getting an error message that says 'invalid argument=value of &apos ...

The function react.default.memo is not recognized at the createSvgIcon error

After updating my Material-UI version to 1.0.0, I encountered a peculiar error message stating that _react.default.memo is not a function at createSvgIcon Despite attempting to downgrade the react redux library to version 6.0.0 as suggested by some ...

Display the output returned from the AJAX request (HTML and/or JavaScript)

How can I effectively render content from an ajax call when the response may include html and/or javascript? I used to rely on document.write() for synchronous calls, but now that I need to use asynchronous calls, I have to find a different approach to dis ...

Guide on utilizing the History API or history.js to dynamically update the "active" link based on page refreshes and back button presses

Highlighted active links using JS on my website. <script type="text/javascript> $(document).ready(function(){ $("a.nav1").click(function() { $(".active").removeClass("active"); $(this).addClass("active"); ...

JavaScript form validation eliminates input data

I recently started using the JavaScript library for client-side form validation called Bouncer. It has been working really well, but I have encountered a peculiar behavior that I need help understanding. My form has two submit buttons with different value ...

Is there an alternative method to handle the retrieval of JSON data without encountering numerous errors?

I'm currently in the process of instructing an LLM model to generate a blog. I used Mistral as the base model and set up an instruction to return JSON output. I then created a function that takes the prompt as an argument and returns generatedPosts as ...

In Vue, it is not accurate to measure overflow

I am working on creating an overflow effect with tagging that fades out at the beginning to provide a subtle hint to users that there is more content. Here is what it currently looks like: https://i.stack.imgur.com/fXGBR.png To achieve this, I added a fa ...

Conceal social media icons when hovering over specific images similar to the feature on the website medium

I am facing an issue with fading out social links that appear over medium and large images on a webpage. I want the social links to fade out when they are over the images and fade back in once they move off the images. The number of medium and large images ...

"Upon pressing the submit button in the router.post function, a null value appears

In my form, I am attempting to redirect the page to the home URL after clicking the submit button. However, using res.redirect('/home') is not achieving the desired result. I have also tried using console.log("testing");, but that is not working ...

Issue encountered: The Android build is failing with the error message stating that "null is not

I recently integrated a private gitlab repo (react native module) into my App's package.json. The index file within my private gitlab repo can be viewed here: https://i.sstatic.net/uObHe.png For iOS methods, please refer to this link: https://i.ssta ...

What is the best way to incorporate two range sliders on a single webpage?

I recently started using rangeslider.js on my webpage. I wanted to convert two input fields into range sliders, so I began by converting one successfully. Initially, the HTML code looked like this: <div class="rangeslider-wrap"> <input type=" ...