⬆️ ⬇️

Cross Domain Exchange: Anonymizer + Frame

Since for projects on the knees or rendering free assistance, the toad strangles on writing and using its own proxy (it takes money and time), there is an idea to replace the proxy with existing anonymizers.

================================================= =====================================

The idea allows you to: read-write content and message on the selected site,

authorize, install and execute scripts.

================================================= =====================================







================================================= =====================================

The essence of the idea is:

All documents connected via anonymizer work on the same domain.

Cross-domain exchange is carried out using frame frame1 with switchable tabs, in which there are two copy documents from the current top.document. The first one is with the same address as top.document, the second one is located on the domain with anonymizer.

Tabs with documents are exchanged between themselves through window.name . As a result, through this frame, the interaction of documents on the domain with the anonymizer and documents on the top.document domain is carried out.



Initial setting:

1. The script for the installation of the exchange of one, initially located on the main document, consists of three parts, working in the corresponding ' document-N '.

The necessary part is triggered by analyzing the corresponding key " key " in the current address of the document.

Note For ' addr0 ' used in frame addresses, if top.document has an initial hash (# ...), delete the hash;

')

2. Initially, the script sets the frame frame0 with the address anonimaiser + addr0 + "#" + " key ," + addr1 ,

Where:

addr0 - the address of the current page without hash;

key - a key is a sign necessary to connect and work the necessary part of the script to the corresponding document.

addr1 - address of the requested page;



3. Part of the script working in the frame frame0 frame frames inside itself: frame2 and frame1 ,

frame2 - put first.

frame1 - placed with the primary address anonimaiser + addr0 + "#" + "key2" ;



4. document-2 in frame1 switches to document-3 with the address addr0 + "#" + "key3" ;



5. By onload document-3 - we launch the callback function on document-0 when the installation of frames is complete.

- Important: After the installation and launch is completed, it is possible to add new addresses of simultaneous communication by simply adding to frame0 - “one more frame - one more address”

And the opportunity to organize on the client a compound switched exchange between these sites.

================================================= ======



Data exchange:



1. The exchange between documents: document-3 and document-0 is better done through LocalStorage, - this will allow you to continue the session “cross-domain exchange” after-closing / opening / changing the tab top.document.



2 Jumping tabs in frame: To organize the exchange, tabs with document-2 and document-3 are switched back and forth. Data exchange between tabs from different domains in frame1 is done through window.name .



3. It is better to exchange between document-2 and document-4 through the function of the parent frame0 function preset . This function performs the presets for the document-4 window on onload when dynamically changing the address addr1 , and also performs the functions of synchronization of communication when requested from document-4 to document-2 when the current tab document-3 is on .

=========================================



Addition 1:

To speed up the loading of frames: ( document-1 , document-2 , document-3 ), the script itself is set as close as possible to the top of the page. If the current address contains the above keys ( key , key2 , key3 ) at the end of the script that works on this document, do the following:

document.write(''),

.

=================================================================



: ... postMessage/XMLHttpRequest2/XDomainRequest ?

, , . : 1. , Access-Control-Allow-Origin. (



2. C .

.
document.write(''),

.

=================================================================



: ... postMessage/XMLHttpRequest2/XDomainRequest ?

, , . : 1. , Access-Control-Allow-Origin. (



2. C .

.
document.write(''),

.

=================================================================



: ... postMessage/XMLHttpRequest2/XDomainRequest ?

, , . : 1. , Access-Control-Allow-Origin. (



2. C .

.
document.write(''),

.

=================================================================



: ... postMessage/XMLHttpRequest2/XDomainRequest ?

, , . : 1. , Access-Control-Allow-Origin. (



2. C .

.
document.write(''),

.

=================================================================



: ... postMessage/XMLHttpRequest2/XDomainRequest ?

, , . : 1. , Access-Control-Allow-Origin. (



2. C .

.

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



All Articles