Options to define link HREF - href

Is there a way to specify a link to say don't navigate. There is an option to specify href="#". But if the link output is directed to a target this will cause the calling page to be loaded in that target.
In a file called load.php I have these links defined for folder nodes in a navigation tree.
link
The page nodes under the folders have
page link
Each link in the navigation tree is directed to a content area.
Here is the problem. If I click on a folder, the href="#" causes the tree page to be loaded in the content area. I want to specify the href to not load anything in the content area for the folders. I have a workaround where I load a blank page. But if there is a different way I would prefer that.

I would do this with JavaScript. Specifically you can load the jQuery library and do something like this:
$("a[href='#']").click(function(event) {
event.preventDefault();
event.stopPropagation();
});

Related

how to create an #section link equivalent in Apex 5.1.3?

Is there a way to create a link into the navbar similar to an:
link
I can't find any place in the UI to set the link to a subsection.
Basically I have a page with regions, and I need that my link in the navbar to send to a specific region.
Thanks.
I never did what you're asking, but - when you choose a region, in its properties, under the "Advanced" section, you'll see the Static ID. Would it help if you put "section1" in there?

Different href for links to open inline v/s new tab

I have a single page application (MySPA). The MySPA is loaded as a stand alone application or as part of another iframe based SPA where MySPA is loaded in an iframe.
When loaded as stand alone, the url looks like http://..../mySPA#home
When loaded as part of another SPA, the url looks like http://..../foo/mySPA#home
The challenge I am facing is ...
The links inside MySPA have their href="#dashboard" or href="#listView". When I click on these links, they do the right thing in both the environments.
But when user right-clicks and "Open in New Tab" or Command+Click, a new tab is opened and the iframe context is lost and MySPA goes in a stand alone mode.
I was wondering if there are any patterns around this and what is the cleanest way to solve this problem.
The BASE HREF solution does not work because the links have to be dynamic in this case (different href for opening inline and a different href for open in new tab).

Sitecore, Content Editor, not generating links

I am having problem with content editor, I am using tool bar of content editor to generate hyperlinks, following is my HTML
<li>w</li>
<li>a</li>
<li>awealth</li>
<li>wwealth</li>
<li>ds</li>
some items are successfully linked to appropriate files but some links are rendered as they are and when i click on them i see page not found. IDs are valid, I have verified.
What could be the reason, Why some links aren't converted to links to actual files? Any other way to use content editor?
You need to render the field using Sitecore Controls:
<sc:Text runat="server" field="MyFieldName" />
sc:Text derives from the FieldRenderer.
You should consider reading http://sdn.sitecore.net/upload/sitecore6/64/presentation_component_api_cookbook_sc64-a4.pdf (sc:Text is used on page 36)

How can I fix a false positive in the Broken Links report?

I have some item content that is working just fine... but shows up as a broken link in the Broken Links Report. The link in question is in a Rich Text field:
<img style="WIDTH: 700px; HEIGHT: 1029px" class="imageBG" alt="All Alaska Map" src="~/media/Images/NorthToAlaska/maps/allAlaskaRouteFLNew.jpg?w=700&h=1029&as=1" />
If I use the built-in editor and insert an image, it generates a link like this:
<img width="700" height="1029" alt="All Alaska Route Map" src="~/media/F82D13579F3A4D0E88C4436D84A562F8.jpg?w=700&h=1029&as=1" />
I should note, that even using the "Insert Media Item" button, it shows up as a broken link. :(
In general, I'd much rather have the image path referenced than an item GUID that is impossible to identify if I'm just looking at it.
1) Why does that first link show up as broken, even though it works fine on the site?
2) Is there any way to get the editor to insert media item links with paths instead of GUIDs?
3) Alternately, is there a way to modify the way broken links are detected or reported?
Hej Bryan
1: Did you try to rebuild the Link Database?
To rebuild the Link Database you just have to open the Control Panel and go to the Database point. There will be an option where you can rebuild the Link Database.
2: I'm asuming you are meaning the rich text editor. It's on purpose that it inserts IDs instead of paths. If Sitecore would use paths it couldn't detect if you move the target item elsewhere in the tree. To get friendly URLs out of that you need to use the right controls of Sitecore. In XSL for example sc:fld won't render friendly URLs use sc:field instead.
3: In what way do you want to modify it? A custom report?

jQuery.load() a JSP into a div

I am looking for some info on JSP imports. I currently have a main.jsp. A jsp is loaded into a div using jQuery upon user selection of of an item. then inside of that div, a modal dialog is opened upon another selection, and a jsp is loaded into that. All the data is coming back ok, but the CSS formatting is off. Each of the JSPs has a head and body and can run separately. They look fine alone, but start getting different CSS attributes when together. Should I be able to strip off the head and body of the second and third loaded JSP, incude all the necessary js and css files in the main and have it work fine? Do I need to have the head and body tags? I am using a jQuery .load() call.
You do not need to include head and body tags in the content that is being loaded via the jquery load call.
When you do model popups, jquery moves your div markup to the end of the document. So if you had some css that was pretty specific, such as
#content #model { ... }
It wouldn't work because jquery will move the markup to the bottom of your page.
You don't need to have body or head tags for loaded pages.
Unfortunately if you want reliable cross-browser formatting for loaded pages it's better to go with inline styles for them. Not sure if IE9 will have this fixed, but I beleive earlier versions ignore style for loaded pages whether it's specified in the main page or loaded page itself.