Appery adds a reference to my javascript file in all my pages
Appery adds a reference to my javascript file in all my pages
Hi Benny,
Not sure I understand..
You can add the JavaScript code on Page Load event (fires once for start screen / each time you open the page for other pages).
Hi Katya,
When I code outside of Appery (e.g. Visual Studio) and write my own HTML files, I am free to add code<script src="...">/code tags as I wish in each page.
When I create a javascript file (say myscript.js) in Appery, Appery automatically adds a code<script src="myscript.js">/code to each page.
I want to be free to decide which page references the javascript. I hope my question is clear now.
Thanks, Benny
Hi Benny,
There is no way to choose pages to add custom code in Appery.io.
Here is the solution:
Describe all of your code in functions which is called on Load event (or any other event) for those pages in which this code is needed. Or, before exporting the project you can delete lines with the script on pages where it is not needed.
Hi Katya,
Thanks. I think Appery should support choosing the pages I wish the js to be referenced. I don't see a reason not to. But I understand that this is the case now. How can I make this a suggestion?
So, if I add custom script that runs on events (in the events panel), where can I see my custom event handling code? I mean which source file includes this code?
Benny
Hi Benny,
You can do this in JavaScript file of page where you add an event.
For example, this is startScreen.js for startScreen.
Hi Katya,
I looked in this file (under Source/Web Resources) but found no trace of my code.
Hi Benny,
Source code is changed only when you export or preview the application, that is to apply them you must click the "Test" button.
If this doesn't help - most likely you changed the page source before creating custom JavaScript. Please roll back the changes (http://docs.appery.io/tutorials/sourc...), and then the code appears.