Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Preview page function

Status
Not open for further replies.

starrwriter

Programmer
Joined
Jun 16, 2004
Messages
8
Location
US
I have written a preview page function for the WYSIWYG editor I'm developing, but it doesn't work and I can't figure out why. I get error message "Access denied" on one line. Here's the script:

function previewPage() {
iView.document.execCommand('SaveAs',null,'popup');
win.document.write('popup'); //Error here: Access denied
win = window.open(", ", 'popup', 'toolbar = yes, menubar = yes, status = yes, scrollbars = yes, resizable = yes');
}

(iView is the name of the iframe where the HTML is written for the page under construction.)

I have a script to preview the outerHTML (body only), but that doesn't include effects from javascript or CSS in the <head> section. I know the page has to be saved before it can be previewed in full, which is why I inserted the execCommand SaveAs line first. But why won't the script write the HTML for the popup page to be opened?
 
Probably because you're using an IFRAME. I've run into a lot of access denied errors while using IFRAMEs so I tend to stay away from them if possible. Couldn't you open a new window to show the preview?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top