Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Note that JavaScript's same origin policy means that script running in a page loaded using this method will be unable to access content loaded using any scheme other than 'data', including 'http(s)'. To avoid this restriction, use loadDataWithBaseURL() with an appropriate base URL.

public void loadDataWithBaseURL (String baseUrl, String data, String mimeType, String encoding, String historyUrl)
  

Note that content specified in this way can access local device files (via 'file' scheme URLs) only if baseUrl specifies a scheme other than 'http', 'https', 'ftp', 'ftps', 'about' or 'javascript'.

I don't know what do these 2 sentences mean and when to select between the two ?

Thanks in advance

where else in

public void loadDataWithBaseURL (String baseUrl, String data, String mimeType, String encoding, String historyUrl)

where baseUrl could be the base url such as the path to asset folder, or SDCard or any other path, where your images or the other media resides related to your html, and I am not much aware of historyUrl

accoring to the docs of [loadData][1]

Note that JavaScript's same origin policy means that script running in a page loaded using this method will be unable to access content loaded using any scheme other than 'data', including 'http(s)'. To avoid this restriction, use loadDataWithBaseURL() with an appropriate base URL.

means loaddata will only include the part which is resides in the first parameter.

Note that content specified in this way can access local device files (via 'file' scheme URLs) only if baseUrl specifies a scheme other than 'http', 'https', 'ftp', 'ftps', 'about' or 'javascript'.

simple meaning of above is you can access the data from http and... other by passing the baseUrl

for example I have written HTML which required tons of image from my ftp or other place what I would do is pass the url of my ftp in baseURl parameter and I can access to my images

@Yama moto consider this... en.wikipedia.org/wiki/File_URI_scheme, which mentioned:- used to retrieve files from within one's own computer. in our case it is phone – Nixit Patel Sep 14, 2012 at 10:50 Does this mean using null for base url will allow me to access javascript from different domain ? – Pradeep Apr 21, 2016 at 2:27 when I pass in the baseURL the path to the location of the file on the device (file://...) the webview accesses the content beautifully but is no longer responsive to any link or anchor in the file. kindly take a look at this question: stackoverflow.com/questions/57165203/… – coder Oct 25, 2021 at 5:17

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.