Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Javascript src path...

Reply
Thread Tools

Javascript src path...

 
 
JJ
Guest
Posts: n/a
 
      07-11-2006
In my master page I am refering to a javascript source file:
<script type="text/javascript" src="swfobject.js"></script>

However, this src path will not be valid if any of my files using the master
are in other directories...( as they are).

How do specifiy the source file absolutely so it can be accessed from any
location on the webserver ?

JJ


 
Reply With Quote
 
 
 
 
John Prado
Guest
Posts: n/a
 
      07-11-2006
This is an option, the easiest in my opinion:

<script type="text/javascript"
src='<%=ResolveUrl("~/swfobject.js")%>'></script>

JJ wrote:
> In my master page I am refering to a javascript source file:
> <script type="text/javascript" src="swfobject.js"></script>
>
> However, this src path will not be valid if any of my files using the master
> are in other directories...( as they are).
>
> How do specifiy the source file absolutely so it can be accessed from any
> location on the webserver ?
>
> JJ
>
>

 
Reply With Quote
 
 
 
 
JJ
Guest
Posts: n/a
 
      07-11-2006
That helped a lot - thanks,
JJ

"John Prado" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> This is an option, the easiest in my opinion:
>
> <script type="text/javascript"
> src='<%=ResolveUrl("~/swfobject.js")%>'></script>
>
> JJ wrote:
>> In my master page I am refering to a javascript source file:
>> <script type="text/javascript" src="swfobject.js"></script>
>>
>> However, this src path will not be valid if any of my files using the
>> master are in other directories...( as they are).
>>
>> How do specifiy the source file absolutely so it can be accessed from any
>> location on the webserver ?
>>
>> JJ
>>


 
Reply With Quote
 
Jacek Stawicki
Guest
Posts: n/a
 
      07-11-2006

Użytkownik "JJ" <(E-Mail Removed)> napisał w wiadomości
news:(E-Mail Removed)...
> In my master page I am refering to a javascript source file:
> <script type="text/javascript" src="swfobject.js"></script>
>
> However, this src path will not be valid if any of my files using the
> master are in other directories...( as they are).
>
> How do specifiy the source file absolutely so it can be accessed from any
> location on the webserver ?


John wrote one, and others are:
src="/file.js"
src="http://domain/file.js"


--
JS
BRE Bank Dev Team, Poland


 
Reply With Quote
 
John Prado
Guest
Posts: n/a
 
      07-11-2006
Jacek Stawicki wrote:
> Użytkownik "JJ" <(E-Mail Removed)> napisał w wiadomości
> news:(E-Mail Removed)...
>> In my master page I am refering to a javascript source file:
>> <script type="text/javascript" src="swfobject.js"></script>
>>
>> However, this src path will not be valid if any of my files using the
>> master are in other directories...( as they are).
>>
>> How do specifiy the source file absolutely so it can be accessed from any
>> location on the webserver ?

>
> John wrote one, and others are:
> src="/file.js"
> src="http://domain/file.js"
>
>


This works too but in a develop environment with a server in root and a
lot of other app in sub directories this could be a problem.

With the ResolveUrl you can assigned the src of scripts in root of your
app instead of root server.
 
Reply With Quote
 
JJ
Guest
Posts: n/a
 
      07-12-2006
Yes - in this case I am not sure what the final domain name will be, and it
may well change.

"John Prado" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Jacek Stawicki wrote:
>> Użytkownik "JJ" <(E-Mail Removed)> napisał w wiadomości
>> news:(E-Mail Removed)...
>>> In my master page I am refering to a javascript source file:
>>> <script type="text/javascript" src="swfobject.js"></script>
>>>
>>> However, this src path will not be valid if any of my files using the
>>> master are in other directories...( as they are).
>>>
>>> How do specifiy the source file absolutely so it can be accessed from
>>> any location on the webserver ?

>>
>> John wrote one, and others are:
>> src="/file.js"
>> src="http://domain/file.js"
>>
>>

>
> This works too but in a develop environment with a server in root and a
> lot of other app in sub directories this could be a problem.
>
> With the ResolveUrl you can assigned the src of scripts in root of your
> app instead of root server.



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What does the SRC in <IMG SRC> stand for? pheadxdll HTML 16 06-06-2007 02:45 AM
Convert Java Src to J2ME Src? macbrando@gmail.com Java 1 03-23-2007 01:29 PM
<txt src= ...> equivalent of <img src= ...> Steve Richter ASP .Net 3 02-09-2006 08:44 PM
src.jar (src.zip) missing on Mac OSX Java 1.4.1 installation? Greg Johnson Java 4 09-18-2003 07:21 AM
Problem: Setting MSIE iframe innerHTML change relative href/src to absolute href/src Soren Vejrum Javascript 4 07-05-2003 01:47 PM



Advertisments