Access Context Path Using Javascript?

Jul 11, 2006

I am running my website using Weblogic, so the path is something like
http://<myip>:<port>/<servername>/


On JSP pages I can use <%=request.getContextPath()%to get the root
path of the site, ie that specified above. How can I get the same using
Javascript?

For example, something like <a href='/home'>..</awill not work as
that would point to http://<myip>:<port>/home and needs to point to
http://<myip>:<port>/<servername>/home

View 1 Replies


ADVERTISEMENT

Get Context Path In Script Functions?

Nov 7, 2011

I am trying to get context path of my Applcation. But it is showing errors in that. Can you please mention the way how to get context path in javascript functions.

View 4 Replies View Related

JQuery :: Access Parent Context From $.post?

Oct 26, 2011

Is it possible to access the parent context within $.post to asign the result to the parent selection?

See this code here:
$("a[href='country#']").click(function(event) {
var dieBusinessUnit = 'THIS VAR SHOULD CONTAIN RESULT OF $("businessunit", xml).text())';

[Code].....

View 5 Replies View Related

Can Set Context / Scope For MyStartAction So It Can Access Variable?

Jan 31, 2011

[code]how i can set context/scope for myStartAction so it can access (this.url) variable?console.log(dd.url) will work but i can't predict what name will object have (that depends on user) there might be more than one instance of myObject

View 10 Replies View Related

Access Cookie Of Different (More Specific Path) But Same Domain?

Aug 18, 2010

Is it possible to access cookies set on a different path (but same domain) with js? So say the web page with js being accessed is a file in the root html directory, and for that domain a cookie is already set in the browser with a path say, '/abc/'. Is it possible to access that cookie from the just described js?

View 4 Replies View Related

Foist Javascript Into Another Frame, And Evaluate It In The Target Context

Dec 16, 2006

I have an outer page and an inner iframe. The outer page calculates some
javascript, and wants the inner frame to run it. The inner frame should hit
a page on the same (private) web server, so this is not a cross-site
scripting attack. But I would prefer not to taint the target page with any
extra logic to do this. (I will if I must.)

The calling page has these elements:

<script src="/javascripts/prototype.js" type="text/javascript" />...
<span id='update_me'>yo2</span>
<iframe id='grinder' src='sample.html' >
</iframe>

So here's most of the page which the iframe hits:

<script src="/javascripts/prototype.js" type="text/javascript" />...
<body bgcolor='silver'>
<span id='update_me'>yo</span>
</body></html>

Note that both the outer and inner page have a span with the same ID.

This question will resemble a JavaScript FAQ - how to evaluate Javascript on
the fly, or how to reload a JS file. The answers on the web generally do not
transport the JS across a frame boundary, so they don't address the bug I
encountered, and I can't tell if prototype.js or IE is at fault.

The outer page calls Ajax goodies that generate some JS looking like this:

Element.update("update_me", "here I B");

The page sends that, as a string, into this JS (in application.js):

function update_grinder(sauce)
{
var grinder = $('grinder');

if (grinder)
{
var doc = grinder.contentDocument;
if (!doc) doc = grinder.document;
if (doc)
{
evaluate(doc, sauce);
return;
}
}
document.write("your browser sucks");
}

So that contains enough logic to find the iframe's document, and it works
for Firefox, IE, Konqueror, and Opera. The code calls evaluate() with the
document where we need the evaluation context, and the string with our
source.

Here's evaluate():

function evaluate(doc, sauce)
{
var s = doc.createElement('script');
//s.defer = true; // <-- no effect
s.text = sauce;
var body = doc.getElementsByTagName('body').item(0);

if (body)
{
body.appendChild(s);
return;
}
body = doc.body;
if (body)
{
body.appendChild(s);
return;
}
}

That creates a <scriptblock, sticks our string in as its contents, and
pushes the block to the end of our <bodytag. Now here's the bug:

Firefox updates the inner <span id='update_me'>, and IE updates the outer
one.

If I remove the outer <span id='update_me'>, then IE simply can't find it
and throws an error. Even though it evaluates a script block clearly in the
context of the inner iframe.

I have tried calling the script from setTimeout, and from a button's onclick
handler.

Is there some script.aculo.us way to fix (yet another) bug in IE? Or is this
a bug in prototype.js?

View 15 Replies View Related

Retrieving Path Using Javascript

Jun 30, 2006

i just wanted to retrieve path of a file residing on local client
system using javascript

View 5 Replies View Related

Change The Domain, Keep The Path..with Javascript?

May 25, 2007

I'm currently at http://www.domain.com/the-path.jsp, and I would like
to be able, with JavaScript--and possibly the click of a button, which
I will most likely attach to IE's toolbar--transport to
http://domain.dev.domain.com/the-path.jsp.

Here's the environment: My browser is set to the page http://www.domain.com/the-path.jsp
and I plan to add a button to IE's toolbar via the registry that I
would like to execute the JavaScript, which contain the code to
perform the aforementioned procedure.

My JavaScript knowledge is, as I'm sure you've already surmised,
limited.

Here's what I know (or what I think I know)

The .js file header:
oShell= new
ActiveXObject("WScript.Shell");

the object: window.location.replace [or href].

I have a feeling a "and if" statement is needed here. Am I correct?

BTW: As far as the registry button addition is concerned, I'm set on
how to do that.

View 2 Replies View Related

Replace Image File Path With Relative Path To File Name

Apr 27, 2009

I'm using a script to include images into a slide show using direct URLs to the image files, but I am using fckeditor (PHP) for my users to edit their content. The script in the .js file that pulls the images into the slide show.The user's image file is going to be named something like, "userImage01.php". Inside that file would be their image location path ~ "images/user/image1.jpg".Therefore, I need the above javascript to pull-in "userImage01.php" INSTEAD OF the image's location path.

View 10 Replies View Related

How Do I Access A Javascript Var With Php

Jul 11, 2004

I have a javascript variable containing the return value from a call to showModalDialog(...)

var rval = showModalDialog(...)
I can display the contents of rval using alert or in an iframe, so I know it isn't null, but I want to save it to a mysql database using php.

View 10 Replies View Related

Javascript Access To Calculated Css?

May 26, 2005

I am looking for a way to troubleshoot css rendering problems. Is there a way to find the calculated styles for any object? I would love to be able to mouse over an element and see all the styles that are causing the element to be where it is, and look the way it does. The elements must "know" this information. Cross browser would be great, but we mainly deal with intranet apps based on IE. Code:

View 1 Replies View Related

Javascript Forms Access

Sep 21, 2005

i have this select element

<select name="prods[]" multiple>
</select>
or

<input type="text" name="text[]">
now how do I access it in javascript to get the selected items and whatnot.

View 2 Replies View Related

Javascript File Access

Aug 3, 2000

How can a script read a text file located on the same server as the javascript source from the script itself?

View 1 Replies View Related

Access An Embed Object Via Javascript

Jul 23, 2005

I want to access the features of a plugin without actually embedding
it into a page. Is this possible? Eg

The code to embed the object into a page is:

<OBJECT classid='CLSID:7FA62735-AHC3-14d2-9F81-00114B3245C5
codebase='http://www.test.com/plug.cab#version=3,1' "id='myPlugin'
height=&#390;' width=&#390;'>

<EMBED type='application/x-myPlugin' name='myPlugin' hidden='true'
src='in.txt'></EMBED>

</OBJECT>

I could simply add this using document.write, but for various reasons
I dont want to do this.

I would rather do something like:

var plugin = (navigator.mimeTypes &&
navigator.mimeTypes["application/x-Web-Plugin"]) ?
navigator.mimeTypes["application/x-Web-Plugin"].enabledPlugin : 0;

myObj = new object("CLSID:7FA62735-AHC3-14d2-9F81-00114B3245C5");

myObj.pluginMethod

View 2 Replies View Related

Access Child JavaScript Object

Sep 30, 2007

I have a page (page 1), my page 1 has an IFRAME which loads another page (page 2).

My page 2 has a JavaScript object declared on the page: var MyObject = new Object();

I want to access this object from the parent page (page 1).

I tried:

var TempObj = document.getElementById("MyIFrame");

TempObj.document.MyObject.value = "blah blah";

But it said MyObject didn't exist.

Can someone tell me how to access it in this manner?

View 2 Replies View Related

Disallow Access To A Page If Javascript Is Disabled

Mar 31, 2005

I want to redirect my user to an alternate page if javascript is disallowed on their browser. Is there a way to do this ?

View 3 Replies View Related

Can You Access HTTP Headers In Javascript (Remote_User)

Jul 24, 2002

I need to access the CGI Variables or HTTP Headers in a request. Can I do that in JavaScript? Specifically I need to access the CGI variable remote_user.

View 3 Replies View Related

Unable To Access Javascript Function On <body> From <head>

Jul 23, 2005

in the body tag, I have this code (just to test):

<script LANGUAGE="javascript">
<!--
function hiThere() {
alert("hi");
return true;
}
//-->
</script>

in the head section, I have this code:

<script LANGUAGE="javascript">
<!--
document.body.onload=hiThere();
//-->
</script>

By the way, I know someone will comment, by "does not work, I mean on
the load of the page, the alert is not displayed, nor are any errors.
Thanks for any help you can offer.

View 2 Replies View Related

Problem With IE And (ajax) File Upload Via Iframe: Javascript Error Access Denied/zugriff Verweigert

Feb 14, 2007

i want to do (multiple) file upload(s) and display a progress bar.
with firefox and safari it is no problem at all. only IE makes some
problems.

my script is based on ajax-uploader, which can be found at
www.srmiles.com/freestuff/ajax_file_uploader/ . you can do multiple
file uploads. each upload will have it's own "form"-tag, so that each
file is uploaded for its own. could be a good solution if there are
"big" uploads.

so here is what i do:

i have a html-page in which several forms with file-input fields are
generated. when i now hit the "one" submit button at the bottom of the
page a javascript function upload() starts it will iterate through all
forms (id='frmUpload_xx'), will get the filename, start a ajax request
for the progress-bar function and do a form.submit().

if the first form/file is uploaded, a settimeout('upload()', 1000); is
called and the next form will be processed. all form's have an
target="uploaddiv", where uploaddiv is a invisible iframe. so the
output of the upload script is put in this div. output should only be
a "OK" at the end. no usefull output no info no nothing.

firefox and safari are working as expected, only IE stops after the
first file is uploaded. i get an javascript error saying "zugriff
verweigert/access denied" on object line x... this is the place where
i call "form.submit()".

this is the upload-function:

function upload() {
if (uploads.length>0) {
form = document.getElementById('frmUpload_'+uploads[0]);
if (form["filename"].value == ""){
alert("Please Choose a file to upload.");
} else {
filename = form["filename"].value;
if (filename.lastIndexOf("")>0) {
filename = filename.substring(filename.lastIndexOf("")
+1,filename.length);
} else if (filename.lastIndexOf("/")>0) {
filename = filename.substring(filename.lastIndexOf("/")
+1,filename.length);
}
makeRequest("upload_progress.php?sid="+sid
+"&filename="+filename,progress);
form.submit();
}
}
}

the strange thing is, that filename is filled correct, that means the
object "form" is found and exisits. the first iteration is working,
only the second ends with an error.

think it have something to do with redirecting the output of the
upload-script in an iframe. after that IE can't access form - at least
IE is not allowed to submit the form as i can access a form field
(filename).
i worked on that the last two days and haven't found a solution...

View 3 Replies View Related

"Access Denied" Submitting Form With Javascript?

Jul 23, 2005

The following javascript code generates an "Access denied" error at the indicated line.

This sample should allow the user to click "Browse" and choose a file. Once
the user has selected a file the form is automatically submitted. I'm trying
to avoid having seperate browse and submit actions.

Can someone explain why I'm getting the error and how I can accomplish this
task? Code:

View 2 Replies View Related

Node.context.nextElementSibling.value Nothing In IE8?

Mar 25, 2011

I am building an sftp application. It has requirements to upload and download. To upload, a target folder that exists on the server needs to be set. I have a jQuery folder tree that dynamically creates a tree view of a directory on the server. Currently in Firefox, Opera, and Chrome if someone clicks on a branch of the tree on the afterClick event I am able to get the target path by using the DOM via node.context.nextElementSibling.value; The code for the afterClick is:

[Code]...

View 6 Replies View Related

ADD To Context Menu?? RESTORE It??

Dec 12, 2005

I know how to disable the context menu (the right hand mouse button) and how to replace it by my own menu. I also know that not everybody likes this - so let's not discuss about that here.

What I can't figure out and what I would like to know, is:
1) How to ADD elements to it, i.e. keep the original contents and add something to it;
2) How to RESTORE it to its original contents.

Does anyone know the code for a simple working example of these things?

View 1 Replies View Related

Dynamicly Changing Context Menus

Jul 29, 2005

I'm making a web application which is a copy of existing desktop application.
I use telerik controlls for MS visual studio I have a little bit complicated situation beacuse I need context menus but the main problem is that they have to be downloaded from server after the page loads. I can't load all of them on page because there are to many.

This is my solution of the problem. When user right-clicks js download from server through XMLHttpRequest some data from serwer and make menu from them.
But it needs much work to make the menu look nice, now I just have one level
menu.

I've been looking for some controlls that can do the things I need but with
no result.

View 2 Replies View Related

Problem With Dynarch Context Menu

Aug 2, 2007

I am creating html pages with forms where I use Dynarch menu script in a
context menu mode. Their script needs to be initialized like this:
<body onload="DynarchMenu.setup('menu', { context: true });">

This is in the beginning of the html page.
But, in my webpages I have only few pages where I actually use this kind of
menu. Since I use smarty template engine, I have single html-header file for
all pages - it includes the same <html><head><bodyetc. for each page.
So I tried to initialize this dynarch script only within the page that
actually uses this menu. I do it like this:

<form>[...]</form>
<ul id="menu">
[context menu elements definition here]
</ul>

<script>window.onload=DynarchMenu.setup('menu',{ context: true });</script>

This thing works OK in Firefox, however when I load such page in IE6 it
aborts the operation without even showing the page, and the popup message
says:

"Internet Explorer cannot open the Internet site http://example.com.
Operation aborted."

Does anyone know a way how to initialize the DynarchMenu.setup not from the
<bodyelement but from anywhere else in the html page?

View 2 Replies View Related

Event Handlers, OO And Function Context

Sep 11, 2007

I am writing a javascript code that parses dom and finds event
handlers attached to mouseover events. Then i will replace the
existing handler say B() with my own function say A(). When the event
happen and control comes to my function A(), after doing required
processing i will call B() as shown below

<a href = "abc.com" mouseover = "B();"link </a>

while parsing i will have (trimmed down version)

var oldHandler = node.onmouseover;
node.

function A()
{
/ * my code */
oldHandler.call(this);
}

This was working fine as long as B() was a global function. I started
getting problems when B was a member function. For eg:

function Alerter(text)
{
this.text=text;
var me=this;
this.invoke=function ()
{
alert(this.text);
}
}
var sayHi = new Alerter('Hello, world!');

The web developer would have code like
<a href = "abc.com" mouseover = "sayHi.invoke()"link </a>

But this time around, my function A() fails since although i have
handler to sayHi.invoke(), it has to be executed in correct context.
Other wise "this.text" is giving me error because when i say
oldHandler.call(this), i am executing the sayHi.invoke() with the html
element being passed as this.

View 2 Replies View Related

JQuery :: Get The Whole Temp Context After Manipulation

Aug 23, 2010

I am trying to use Jquery as an XML tool to transform xml data other than the DOM.

This works very well and i can change my xml data.

Now i want back my whole xml that i just transform and this is where there is a problem !

$(xml).find('#id').html('some text').parent.parent.parent ... is not a good way

I read something about the defaultContext but it seems risky / hazardous.

Needed fonction would be $(xml).find('#id').html('some text').getRoot().html(); or something like that.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved