Run javascript when opening a doc from embedded view

I have a form with an embedded view, and when a document is opened through this view using double-click, I need to run some javascript to check if the user wishes to save the current document before leaving.

Is there anyway I can relate this code to the view, or is there a web event I can use instead? This code should only ever run if they use this view to exit the document.

Subject: Run javascript when opening a doc from embedded view

  • Put a web hidden field on the document that contains the view the doucment was opened from.- Put your JavaScript in the onLoad event. Have it check the web hidden field to see if the document was loaded from the indicated View. If not, dump out without doing anything. If so, run your code.

  • Hope this helps…