Page 1 of 1

I create my own javascript but wish this javascript file to be referenced by one page only, and not by all of the pages.

Posted: Wed Oct 02, 2013 8:13 am
by Benny Halperin

Appery adds a reference to my javascript file in all my pages


I create my own javascript but wish this javascript file to be referenced by one page only, and not by all of the pages.

Posted: Wed Oct 02, 2013 8:24 am
by Kateryna Grynko

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).


I create my own javascript but wish this javascript file to be referenced by one page only, and not by all of the pages.

Posted: Wed Oct 02, 2013 8:39 am
by Benny Halperin

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="&#46;&#46;&#46;">/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&#46;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


I create my own javascript but wish this javascript file to be referenced by one page only, and not by all of the pages.

Posted: Wed Oct 02, 2013 9:26 am
by Kateryna Grynko

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.


I create my own javascript but wish this javascript file to be referenced by one page only, and not by all of the pages.

Posted: Wed Oct 02, 2013 9:37 am
by Benny Halperin

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


I create my own javascript but wish this javascript file to be referenced by one page only, and not by all of the pages.

Posted: Wed Oct 02, 2013 11:12 am
by Kateryna Grynko

Hi Benny,

You can do this in JavaScript file of page where you add an event.
For example, this is startScreen.js for startScreen.


I create my own javascript but wish this javascript file to be referenced by one page only, and not by all of the pages.

Posted: Wed Oct 02, 2013 11:37 am
by Benny Halperin

Hi Katya,

I looked in this file (under Source/Web Resources) but found no trace of my code.


I create my own javascript but wish this javascript file to be referenced by one page only, and not by all of the pages.

Posted: Wed Oct 02, 2013 12:52 pm
by Kateryna Grynko

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.