JavaScript mailbox form data in a new window without a "target"

What? I would like to be able to make a request to submit (it does not have to be form data) to a new window without using the target attribute (XHTML check).

Why? I have a webapp (using jQuery) where the user selects the number of records to print. Each record identifier must be sent to a processing page on which a printable version will be displayed. I don’t want to direct the user from webapp to print, and I can’t use get in the popup because the number of login IDs may become too large to embed the URL.

I have googled and read some forums, and most people seem to offer either the target attribute directly, or insert it using JavaScript. I was hoping to avoid both of these solutions.

Is this possible, and if so, how?

Thanks in advance:)

+3
source share
6 answers

In Javascript, intercept the form submission, fill out the second form with only the hidden fields with the values ​​you want, and submit this form.

+1
source

, target. "_blank", . , ( ? , !), Javascript, ...

window.onload = function() {
  document.forms[0].target = '_blank';
}

.

+3

, <a href="page.htm" target="_top"> HTML. Javascript :

top.location.href = 'page.htm';

, <a href="page.htm" target="_self"> HTML. Javascript :

self.location.href = 'page.htm';

, <a href="page.htm" target="_parent"> HTML. Javascript :

parent.location.href = 'page.htm';

, <a href="page.htm" target="thatframe"> HTML. Javascript :

top.frames['thatframe'].location.href = 'page.htm';

iframe , <a href="page.htm" target="thatframe"> HTML. Javascript :

self.frames['thatframe'].location.href = 'page.htm'; 
0

target <form> XHTML 1.0 ..

XHTML 1.1 1.0 Strict, <iframe> .

0

javascript window.open "pop" GET URL ... IMO , doctype.

- "" , " " DOM AJAX. , "" ( ).

0

- , ( entryIds), , :

$(function() {
    var $opener = $(window.opener.document);
    var entryIds = $opener.find("#entryIds").val();
    // do something with the ids
});  

The downside here is that you can now display your record data through javascript. No need to make a message in the form at all.

If you feel frisky, you can always set session login IDs or cookies (via a web service call) on an open page before opening a new window, and capture the session on an open page so that you can create a print page on the server side .

0
source

Source: https://habr.com/ru/post/1732562/


All Articles