Discussion Forums  >  Capturing Images, Uploading Data

Replies: 3    Views: 257

Adnan Basra
Aspiring developer
Profile
Posts: 188
Reg: Apr 26, 2013
Salmiyah
2,930
07/08/13 01:12 AM (6 years ago)

Html with css js and Image files

Hi,

I want to create a html page with css, js and image files.In which folder in the project (iOS & android) I should keep css, js and image files to work properly?

Thanks in advance,
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
07/08/13 01:41 AM (6 years ago)
"the one that works" ;)

If you're using an HTML plugin and the file is going to be held within the project, both iOS and the 'Android' is going to expect the HTML file in the 'BT_docs' directory.

The 'HTML' file, is going to expect it's resources somewhere relative to it's location. So, I would suggest that they be placed in a subdirectory of BT_docs. Call it 'rsrc' (or whatever), and inside your HTML, refer to the directory location 'relative' to BT_Docs.

So, if your HTML page looked similar to this:

<html>
<head>
<link media="screen and (max-device-width: 320px)" href="./iphone.css" type="text/css" rel="stylesheet">
<link media="screen and (max-device-width: 640px)" href="./rsrc/iphone5.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src="./rsrc/jQuery/jquery-1.4.2.min.js"></script>
</head>
<body>
<img src="./rsrc/images/myimage.png">
</body>
</html>

This tells me:

1) That the file 'iPhone.css' is in the same directory as the HTML page; BT_Docs.
2) That the file 'iPhone5.css' is in a subdirectory of BT_Docs called 'rsrc'.
2) The JQuery script is in a sub-sub directory of BT_Docs called /rsrc/jQuery/
4) The image is in a sub-sub directory of BT_Docs called /rsrc/images/

This is because the HTML file expects everything to be relative to it's position.

Does that make sense?

Cheers!

-- Smug
 
Adnan Basra
Aspiring developer
Profile
Posts: 188
Reg: Apr 26, 2013
Salmiyah
2,930
like
07/08/13 01:55 AM (6 years ago)
Thanks Smug. Just one thing. why did you put ./ in img src?
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
07/08/13 03:26 AM (6 years ago)
That's just a path thing. It means 'relative to the directory you're in'.

This:

<script type="text/javascript" src="./rsrc/jQuery/jquery-1.4.2.min.js"></script>

and this:

<script type="text/javascript" src="rsrc/jQuery/jquery-1.4.2.min.js"></script>

is the same place (with respect to the HTML doc in BT_Docs).

I've always done it 'that way'. Probably a hold over from a different space and time, when webservers were the latest thing.

Cheers!

-- Smug
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.