Sometimes, when I open my own notebook, I get the message:
This file contains potentially unsafe dynamic content.
I do not remember when I started seeing these messages, but it was not long ago. May be 2-3 weeks ago? They do not show all the time. It is my own notebook, that I could close, go sleep, wake up, come open it up again, and I could see the above message, or I could not. Not sure what triggers it.
Here is a screen shot of one just happened.
I normally just ignore it, and enable dynamics and go on. I googled around, and do not see mention of it. One reference I found is this, where it talks about TrustedPath
and such, and I really could not understand it at all.
This notebook just sits in my folder on my PC, same folder it was on all the time. May be an expert can explain this in easy to understand way, because I do not understand why I need to worry about the trustedPath thing when I am working on my own local PC (I am not even on a network, just stand alone PC in my living room) and what I need to change if any.
I'm using v8.0.1 on windows.
Mathematica notebooks can execute arbitrary code simply by virtue of opening the file. This code could be potentially malicious, and it can be very difficult to predict what the code will actually do prior to executing it.
When you open a notebook Mathematica doesn't know whether you are the original author of the notebook (and you trust the content to run automatically), or whether you downloaded a notebook from the website of a complete stranger (and you shouldn't trust the content to run automatically). The best guess Mathematica can make is based on the location of the file on your computer. Certain directories are trusted (i.e. the Mathematica installation directory) and other directories are untrusted (i.e. your web browser download folder and your email attachments folder). The settings that control which directories are trusted and which are untrusted are described in the documentation page you mentioned.
In your case what's probably happening is that your document is saved in your Desktop directory or some other directory which is untrusted and Mathematica is asking your permission before doing something it thinks may be potentially harmful. Since you know it is not harmful then you are safe to allow the Dynamic content.
If you do not want to see these warnings in the future you can do one of two things:
My comments assume V8 of Mathematica...
For any given notebook, the message appears the first time an expression is about to be evaluated automatically, in some way other than normal user-directed input cell evaluation. So-called dynamic constructs like Manipulate
, Dynamic
and Hyperlink
have the potential of causing such evaluations. The warning message is just a way to ensure that user remains in control.
Sometimes No Warning?
As will be shown in the examples below, the message does not appear until the dynamic code is about to be triggered (e.g. by bringing a Manipulate
into view or by hovering a Hyperlink
). This is why, in the same notebook, you might sometimes see the message and sometimes not.
Manipulate Example
I see from the screenshot that the notebook in question is a Wolfram Demonstrations Project authoring notebook. It almost certainly contains a Manipulate
expression that triggers the message.
Here is a way to cause the warning to appear:
Manipulate[Plot[Sin[x y], {x, -1, 1}], {y, -1, 1}]
-- but do not evaluate the cell.Manipulate
cell.The first time the notebook was re-opened, it did not contain a cell with dynamic content. But when the Manipulate
cell was evaluated, that changed. Thus, on subsequent re-openings the warning message appeared.
Hyperlink Example
All of this true for even seemingly innocuous content, like hyperlinks. Try this:
Hyperlink["http://www.wolfram.com"]
.It appears that WRI is taking a very conservative view about dynamic content. I, for one, applaud that policy. Mathematica presents a huge attack surface for malicious code, so a conservative approach is good in my opinion. (In fact, the new plug-in scares me a little on that score, but that's another story.)
Warning Settings
You can tweak the settings related to the warning message by looking at the Notebook Security section on the System tab of the Preferences dialog.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With