You are trying to edit Tableau Server pages? Did you read someplace about how to do this? This sounds like an unsupported action but if you have some more details, please share.
Haven't read about it - experimented on my own In fact everything that is not set out of the box is an unsupported action.
However - to change document.domain on tableau server you have to do change in 3 files:
vizportalclient/public/vizportalMinLibs.js.gz (which is basically zipped version of the above)
just insert document.domain="top-level-domain.com";
somewhere at the beginning of the files near var declarations.