cancel
Showing results for 
Search instead for 
Did you mean: 

javascript:Permission Denied error..!

Former Member
0 Kudos

Hello all,

This might sound very Weird...!

I am getting an error while using JavaScript's opener onject.

The scenario is that I am trying to provide f4Help functionality, and I open a new page using onValueHelp attribute of inputField.

The specific code in the Jscript function is :

window.open("f4help.htm","","left=300,top=220,width=220,height=400,menubar=0,scrollbars=yes,resizable=no");

Now, this works fin, I get my new page and then when returning the values back, I use opener.setvalue();

But I am getting a Javascript <b>Permission Denied error</b>, while doing the same...

The dilemma is that I am actually using the exact same code in another application, and that works..But its not working here...that's why I said it might sound weird...!!

Now the only difference in the world that i can think of between the applications is that the working one is not included in the transport request while this one is...!!

Any one ever received the same error...??? Or are there any pointers..??

Thanks,

Tatvagna Shah.

Accepted Solutions (1)

Accepted Solutions (1)

raja_thangamani
Active Contributor
0 Kudos

Look at the below thread..

Raja T

Former Member
0 Kudos

Hi Raja,

Thanks for your reply but, I tried all the possible solutions in both the threads, but still the problem persists.

I am not using

<form method = "POST">

.

and the Supports portal integration is already checked.

Also my caller page and the called page is in the same application.

Is there any work-around...??? If you want i can post my code...!

Thanks,

Tatvagna.

daniel_humberg
Contributor
0 Kudos

I would assume that opener.setvalue( ) is only allowed if the opened page and the opener run on the same host.

Can you check the URLs of the opener and the popup? Are you maybe using absolute URLs to open the popup? Can you post the script that you used the open the popup?

(and i am sure it has nothing to do with transport requests)

Former Member
0 Kudos

Hi Daniel,

I did check the URL's of both the pages....Everything is same except for the page name.

Also the script I used is....

<b>In the caller page :</b>

Am calling the function from iterator class...

1) In <b>IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_CELL_START.</b>

when 'MY_COLUMN'.
      ASSIGN COMPONENT p_column_key OF STRUCTURE <fs> TO <l_field>.
      if <l_field> is assigned .
        wf_text = <l_field> .
      endif .

      row_index = p_row_index.
      condense row_index.

      CONCATENATE 'f4_TV(''' p_cell_id ''')' INTO javascript.

      col_inputfield = cl_htmlb_inputfield=>factory(
                                id          = p_cell_id
                                value       = wf_text
                                showHelp    = 'TRUE'
                                onValueHelp = javascript
                                 MAXLENGTH  = '8').
   p_replacement_bee = col_inputfield.

<b>2) Then in Layout of calling page :</b>


function setvalue(cell)
{
    var myID = document.getElementById(readCookie("CKE"));
    myID.value = cell;
}

function createCookie(name,value,days)
{
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function f4_TV(v1)
{
    createCookie('CKE',v1,1);
    window.open("f4Help.htm","","left=800,top=420,width=500,height=400,menubar=1,scrollbars=yes,resizable=no");
}

<b>3) Then in the Layout of the called page..</b>

<script language=Javascript>
var v2='';
var count=0;
function pass(cell)
{
    alert(document.domain.name);
    opener.setvalue(cell);
    alert("Method opener");
    window.close();
}
</script>

Message was edited by:

Tatvagna Shah

Former Member
0 Kudos

Tatvagna,

What u can do is inside ur IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_CELL_START method pass document.domain as the parameter to F4 page

CONCATENATE 'f4_TV(''' p_cell_id ',' 'document.domain'')' INTO javascript.

Then in ur javascript method of calling page add one more parameter to javascript method and pass this parameter either as the querystring or by setting the cookie.

Then in the F4 help page u can use this parameter to set the domain name

document.domain = variable.

By this way u will use same domain as the calling page.

Regards

Rajeev

Former Member
0 Kudos

Hi Tatvagna,

I could imagine that the missing name perhabs makes the problem, as a try:

window.open("f4Help.htm","F4WINDOW","left=800,top=420,width=500,height=400,menubar=1,scrollbars=yes,resizable=no");

If the calling page is marked as HTTPS and the opened page ist HTTP it is a security violation.

Another thing could be that the cookie is not allowed to be read because of security restrictions of the browser?

Regards,

Sebastian

Answers (2)

Answers (2)

Former Member
0 Kudos

Solved long time ago....

Am passing document.domain in the url while calling window.open...

But still this is a temporary solution..!

Former Member
0 Kudos

Hi Rajeev,

Thanks so much for your help..

Indeed I checked my document.domain in both the pages...

It was different...and now I am using a work-around to pass the domain name as a url parameter....

But I still have one more question...<b>how can I acheive auto domain relaxation in my BSP Applications...</b> this is definately a work-around...but....a work-around it is....maybe the BSP Gods can shower some blessings on me....!!!

Thanks,

Tatvagna Shah.

raja_thangamani
Active Contributor
0 Kudos

<i>how can I acheive auto domain relaxation in my BSP Applications</i>

By checking <b> portal integration</b> check box in your application will make domain relaxed

Also look at the below link

http://www.devarticles.com/c/a/JavaScript/JavaScript-Security/

Raja T