Skip to Content
0
Former Member
Jul 10, 2014 at 03:58 PM

JavaScript execution blocked in development enviroment

19 Views

Hi to all,

I need to print some iViews in webDynpro.

I have the following inplementation:

try { IWDWindow win = wdComponentAPI.getWindowManager().createExternalWindow(displayPrint(), "Print", false); win.setWindowSize(600,600); win.removeWindowFeature(WDWindowFeature.ADDRESS_BAR); win.removeWindowFeature(WDWindowFeature.TOOL_BAR); win.removeWindowFeature(WDWindowFeature.MENU_BAR); win.open();

} catch (Exception e) {

wdThis.wdGetReporteHistorialComponenteController().reportError("Error al intentar imprimir el reporte:" + e.toString());

}

public java.lang.String displayPrint( )

{

//@@begin displayPrint()

StringBuffer x = new StringBuffer();

x.append("<html><head><script>");

x.append("parent.print();");

x.append("</script></head>");

x.append("<body>Printing...<hr/><a href='javascript:close();'>CLOSE</a></body>");

x.append("</html>");

String linktoFile = "";

try {

byte[] b = null;

b = x.toString().getBytes("UTF-8");

IWDCachedWebResource htmlFile = WDWebResource.getWebResource(b, WDWebResourceType.HTML);

htmlFile.setResourceName("Print.htm");

linktoFile = htmlFile.getURL();

} catch (UnsupportedEncodingException e) {

e.printStackTrace();

} catch (WDURLException e) {

e.printStackTrace();

}

return linktoFile;

//@@end

}

When I execute this code in my local enviroment It works fine and I can open the print preview from windows, but, in the development enviroment it doesn't work; it opens only the print.htm page, but the print preview from windows doesn't open and in the print.htm page I get an error from javascript.

I get the following error:

Message: Access is denied.

Line: 1

Char: 1

Code: 0

I think may be the server in development enviroment has a specific configuration that doesn't allow to execute the script.

Comparing the url generated between development enviroment and my local enviroment i find that in development enviroment the url generated contains the nex parameter: sap-wd-secure-id=

Dou you have this kind of problem?

Thans in advance.

Blanca