Skip to content
This repository was archived by the owner on Dec 27, 2023. It is now read-only.

Latest commit

 

History

History
32 lines (24 loc) · 967 Bytes

File metadata and controls

32 lines (24 loc) · 967 Bytes

Sending and Recieving Messages API

Any injected application can send messages to the content script (privly.js) to trigger it to resize, show or hide the iframe content. JSON is used for this communication. Injected application can use the following blueprint for sending messages :-

An example of a message could be:

{command:"resize",
	frameID:"name of iframe"
	heightNEW:No. of pixels,
	}

A possible syntax for sending this message over the host would be:

var message = {command:"resize",
	frameID:"name of iframe"
	heightNEW:No. of pixels
	};
 msgJSON = JSON.stringify(message);
 parent.postMessage(JSON.stringify(resizeData),"*");

##Possible set of options

  • command : "resize" | "hide" | "show"
  • frameID : ""
  • heightNEW : no. of pixels

While using hide or show as the command, heightNEW doesn't matter and you may or may not include it in your message.