Navigate between pages in Electron app - electron

In an Electron application, what is the standard way to navigate to different pages / locations when a link is clicked?
I tried creating
<a href="/profile.html>profile</a>
and an HTML file named profile.html, but clicking the link just takes my app to a blank page.
What is actually happening when the link is clicked & what is the right way to do basic links?

Just use a relative link - this will work (note no slash at the beginning):
profile
This is because Electron uses local file:// URLs which map to your file system. If you link to /profile.html that will be looking for the file in the root of your drive, and you probably want it to be loading the file from the same directory instead.
Also if you put the profile.html in a directory called pages you could access it like this:
profile

Electron is designed to work best as a single-page application.
Clicking a link shouldn't load a new page but should manipulate the DOM to changes the contents on the same page.
If you use jquery you could use Tabs to swap between content https://jqueryui.com/tabs/

<a href="./profile.html>profile</a>
use ./{filename} to access the file in the same directory

Related

How to open a file from Grails app using <a> tag?

This is my first Grails project & I can't seem to do this very simple thing! I am trying to display a list of PDF forms in one page that I have saved under a folder called forms under my_project/grails-app/views/forms and want to open the PDF form in a new window when clicked.
In my .gsp file I am trying to access the forms like this:
Form #1
But that's giving me a 404 error.
I have found couple of solutions like this one or this question (which is very similar to mine)...but first of all, i don't need to upload/download the file. Second, i don't need to render the file either. All I want to do is just click the link and open the PDF file in a new window/tab. Am I saving the PDF files in a wrong place? Please help!! Thank you.
Place your file/directory into grails-app/assets so that you have grails-app/assets/forms/form_one.pdf then you can use the resource tag like this:
Form #1
The grails-app/views directory is used for views rendered by controllers, where as the grails-app/assets directory is used for static and pre-processed assets.

How to test mobile web app built with jQuery Mobile with Optimizely?

I've built a mobile web app with jQuery Mobile. In the index.php file, there're multiple pages declared as data-role="some_page_name" and their urls are like index.php#my_profile.
Now I want to use Optimizely to do A/B test on one of the pages. I created one variation and let it redirect index.php#my_profile to a new page, url: index_b.php#my_profile. But I have trouble linking this page to other not-in-test pages.
For example, if I have a link in index_b.php#my_profile like this:
My Favorite
It can't link to the favorite page in index.php. And sometimes if it does, you navigate to other pages, you'll never go back to the B version/variation.
Looks like Optimizely can't adapt to the jQuery Mobile multi-page structure.
Any solutions?
You can try to add more tag in href link, such as,
My Favorite
<a href="index.php#favorite" data-ajax='false'>My Favorite</a>
You also could use full link path with http:// prefix.
My Favorite
And an other option is add a link click JavaScript method. You can control the JavaScript content.
It should be okay on optimizely or visual website optimizer.

Fine control over Joomla URLs

I would like to convert my existing website to Joomla. However, I need finer control over URLs than I seem to be able to control with Joomla. Assuming that Joomla is installed in the base public_html directory of my user, I would like these pages to keep their URLs:
http://dotancohen.com/howto/rtl_right_to_left.html
http://dotancohen.com/eng/genealogy.php
http://dotancohen.com/heb/contact_info.html
I am aware that I could use a 301 redirect via .htaccess however I would prefer to actually configure the canonical URL of the page. Is this possible in Joomla or with an extension?
Unquestionably, the defacto standard extension is At http://extensions.joomla.org/extensions/site-management/sef/10134. It's highly configurable, well supported, and ver well rated.
In Joomla! 2.5 you can use the built-in Redirect component to catch old URLs and send them to the right content without fiddling with the .htaccess.
You can also create menu's and menu items that will match the old paths then all you need is to place the content of your .html files into suitable articles. Remember you can create a menu (and thus a path to the content) but not display the menu anywhere on the site.
The genealogy.php appears to be a separate application so you can approach that by doing two things, first have a /eng/ directory on your new website with the genealogy.php application in it that way it will have the same URL. Then if you want to create a menu item in a Joomla! menu then you can link to it using a menu item of type 'External Link' - you can read more about the menu types by clicking on the help button in the toolbar.
[EDIT]
For external pages if you want to wrap the external application in your template use a menu item type of Iframe Wrapper this will place them in the main component area of the template. With a good Joomla! 2.5 template you can use a template style specific (i.e. layout settings) for that page.

How can I navigate from an html file to another with a spotify uri?

I don't understand how to navigate through an app with multiple .html files. All the examples that I've found have only one html file.
I have two files in my app :
index.html
artist.html
In my index.html, I use a Text, which works but does not add a state in the history.
From what I have read in the documentation, I should use a link like spotify:app:$APPNAME:arg. But I can't manage to make a link like this works to navigate from an html file to another. And because I can only find apps with one html, I'm wondering if all the existing apps only show and hide parts of an html file to simulate the navigation.
You can link internal with:
sp://appname/filename.ext
link to spotify:app:appname:test.
At this point in index.html you can redirect to the page you want (I.e. test.html) using:
location.href=sp.core.getArguments() + '.html'
The initial call to spotify:app:appname:test will be in the history.

Opening my JQTouch Iphone WebApp for the home icon, why every external link open in another safari window?

Using the JQTouch library, usely links like the following ... should open the new page in the SAME window. That works fine when I go to the site using Safari BUT when I launch the site from the home saved icon, it opens a fullscreen site and on the first link it opens a NEW Safari window. How can I make it stay in the same original fullscreen window?
You have to set the target to _webapp. E.g:
<li class="arrow">Some Page</li>
and then it will load on the same page.
You need to look into manifest files.
The manifest file declares what files (html, javascript, css, jpgs etc.) that the iPhone should cache in order to make a webapp work offline. A part of the manifest file is used to declare which URLs are OK to use when in full screen (webapp) mode.
Specifically look at NETWORK in manifest files.
Example:
NETWORK:
*
This should allow access to any URL you like, and stay in webapp mode.
Alternatively use target="_self" - I haven't seen target="_webapp" anywhere.
/Mogens
One solution I found here is to change the way you write your links for a mobile app. Rather than a href='link.url' you'd write a href="javascript.window.location.href='link.url'"
Dislaimer: I haven't personally tried this yet, so I can't guarantee it will work. But logically, it does make sense.
Using target="_webapp" works only if you remove the rel="external", you cannot have both.

Resources