NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

HTML File references don't work in IDE

 
Post new topic   Reply to topic    NetBeans Forums -> Web Client Users
View previous topic :: View next topic  
Author Message
bruceweev



Joined: 10 Dec 2015
Posts: 1

PostPosted: Thu Dec 10, 2015 11:27 pm    Post subject: HTML File references don't work in IDE Reply with quote

How can you reference a file outside of the Netbeans 8.1 project directory. Netbeans seems to do some magic with "Site Root" that shows up in file explorer as "public_html"

I have an index.html in the following directory structure C:\Development\NetBeansProjects\MyHTML5App01\public_html

The following relative and absolute file references don't work in the Netbeans 8.1 IDE but do work if I open the html file directly with Chrome

<img src="../../../BruceW.jpg" alt="FAIL">

<img src="c:/Development/BruceW.jpg" alt="FAIL">

The .jpg is in c:/Development
Back to top
aresgorn



Joined: 04 Jun 2016
Posts: 1

PostPosted: Sat Jun 04, 2016 6:17 pm    Post subject: Re: HTML File references don't work in IDE Reply with quote

bruceweev wrote:
How can you reference a file outside of the Netbeans 8.1 project directory. Netbeans seems to do some magic with "Site Root" that shows up in file explorer as "public_html"

I have an index.html in the following directory structure C:\Development\NetBeansProjects\MyHTML5App01\public_html

The following relative and absolute file references don't work in the Netbeans 8.1 IDE but do work if I open the html file directly with Chrome

<img src="../../../BruceW.jpg" alt="FAIL">

<img src="c:/Development/BruceW.jpg" alt="FAIL">

The .jpg is in c:/Development




I have the same problem. Im crazy looking stuff to fix it.
Back to top
john brock
Posted via mailing list.





PostPosted: Sun Jun 05, 2016 4:11 pm    Post subject: HTML File references don't work in IDE Reply with quote

There is a concept called sandboxing or application scope when it comes to HTML and JavaScript based applications.

When running the app from NetBeans, it starts up a small webserver and servers up the files.  You can not reach outside the root of your application and grab just any file.  Imagine the security hole this would cause.  I could write a page that goes and looks at any file on your system if this was allowed.

You can do this when running the file from the filesystem in Chrome because it's not being served from a webserver, and I would guess that you have bypassed the web security feature in Chrome as well. Smile

You will need to do one of two things to get at that BruceW.jpg file.

1) Change the application root to be above where that image directory is
2) Move the images into a directory that is already inside your application scope.



On 6/4/2016 11:17 AM, aresgorn wrote:

Quote:
Quote:
bruceweev wrote:
Quote:
How can you reference a file outside of the Netbeans 8.1 project directory. Netbeans seems to do some magic with "Site Root" that shows up in file explorer as "public_html"

I have an index.html in the following directory structure C:\Development\NetBeansProjects\MyHTML5App01\public_html

The following relative and absolute file references don't work in the Netbeans 8.1 IDE but do work if I open the html file directly with Chrome

<img src="../../../BruceW.jpg" alt="FAIL">

<img src="c:/Development/BruceW.jpg" alt="FAIL">

The .jpg is in c:/Development




I have the same problem. Im crazy looking stuff to fix it.





--
[/url]
John 'JB' Brock | Senior Principal Product Manager
Phone: [url=tel:+1%204259458729]+1 425 945 8729

Oracle JavaScript Extension Toolkit (JET)
Seattle, WA

Season’s Greetings -->[url=http://www.oracle.com/commitment][/url] Oracle is committed to developing practices and products that help protect the environment
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Web Client Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo