# Avoiding ad "Enable Dynamics" in CDF Player

GROUPS:
 I build my .cdf file from the output of a file .nb (which has evidently interactivity) using File-> Export- cdf> standalone ...). When I open it with CDFPlayer always ask me "Enable Dynamics" (this can be very cumbersome for students).Q: How I can always build my .cdf without this annoying ad?I used the option TrustByDefault but it does not work.I used the option TrustedPath but it does not work.Help!Thank you.
2 years ago
5 Replies
 Rolf Mertig 2 Votes Hola Ernesto, evaluate this (I tested on Windows 10 with Mathematica 10.4.1, but it should also work on Mac): If[$OperatingSystem==="Windows",Quiet@Run["taskkill /im WolframCDFPlayer.exe /f"]];Function[cdfName, CDFDeploy[cdfName,#, Method -> "Standalone",WindowSize->{600,300}, "Target"->"CDFPlayer" ]&@DocumentNotebook[#,Saveable->False,Magnification->1.5]&@ DynamicModule[{tbd} , Column[{ Button["Set option to TrustByDefault -> True ", SetOptions[$FrontEnd,"NotebookSecurityOptions"->{"TrustByDefault"->True,"UntrustedPath"->{}}]; tbd=True;, Method -> "Queued" ], Button["Set option to TrustByDefault -> False ", SetOptions[$FrontEnd,"NotebookSecurityOptions"->{"TrustByDefault"->False}]; tbd=False;, Method -> "Queued" ],TextCell@ Grid[{ {Style["Do not ask for Enable Dynamics: ","Text",ShowStringCharacters->False],Dynamic[tbd(*,UpdateInterval\[Rule]1*)],SpanFromLeft}}, Alignment->Left] }],Initialization:>(tbd="TrustByDefault"/.(NotebookSecurityOptions/.Options[$FrontEnd,NotebookSecurityOptions]))]; If[$OperatingSystem==="Windows", With[{cdfExe = FileNames["WolframCDFPlayer.exe",FileNameJoin[{$TopDirectory//ParentDirectory//ParentDirectory, "Wolfram CDF Player"}],2]/.{cdf_String,___}:>cdf }, ReadList["! start \"\" \"" <>cdfExe<>"\""<>" " <> cdfName,"String"] ], SystemOpen@cdfName ] ]@"SetPlayerSecurityToTrustByDefault.cdf"; Then click "Enable Dynamics" in the CDFNow click the first buttonThis will openwhere you should click "Yes".and this it. You will never be asked about "Enable Dynamics" again when opening CDFs.Rolf
2 years ago
 Update: this also works in Mathematica 11.xObviously this is done at your own risk and after disabling security for CDFs you have to be careful which CDFs to open.However, I usually open my own CDFs, and, trusting me, I never had a problem and I am not bothered by "Enable Dynamics" anymore.I also attach the CDF for simplicity. Attachments: