I have a code generated by the marzipano tool. I'd like to place a link together with a description inside the js
file (see attached marked green).
Asked
Active
Viewed 94 times
0

Ishaan Javali
- 1,711
- 3
- 13
- 23

ser-zhm
- 83
- 1
- 8
-
2Note that Java _is not_ JavaScript. Besides that, what's the problem? What did you try so far? – Thomas Mar 05 '19 at 14:18
-
I have a file generated by "marzipanotool", the file is data.js. In that file I have a title for my image and description. I will write a description for that image and i need to place a hyperlink inside poininting to another website. Hope it's clear explained – ser-zhm Mar 05 '19 at 14:27
-
If there is nothing else in that file, only this `var APP_DATA = {};`, you can manually remove the `var APP_DATA =` prefix and the trailing `;`, and parse the rest as JSON. Popular libraries like [Jackson](https://github.com/FasterXML/jackson) or [Gson](https://github.com/google/gson) can help in the process. Change what you need, and serialize back the result with the prefix+trailer. – tevemadar Mar 05 '19 at 14:30
-
Or, an extremely low-budget approach would be writing there an absolutely unique placeholder (`Description with the hyperlink` may already do the job), [read the file into a string](https://stackoverflow.com/questions/326390/how-do-i-create-a-java-string-from-the-contents-of-a-file), replace the unique stuff and write the result back. No external libraries or parsing involved. – tevemadar Mar 05 '19 at 14:32
-
I just need the word "hyperlink" be an link pointing to external webpage, like html tag: hyperlink How to do that inside js file – ser-zhm Mar 05 '19 at 14:39
-
In that case why don't you just replace that word with escaped html? – Thomas Mar 05 '19 at 14:40
-
how? could write it in here – ser-zhm Mar 05 '19 at 14:42
-
Add `"link" : "www.website.com"` to your JS file, and then use it in your HTML to produce `hyperlink` – Jeremy Thille Mar 05 '19 at 14:52
-
i figured out :) thanks – ser-zhm Mar 05 '19 at 14:53