how to use *ngIf="isAndroid and "!isAndroid - javascript

I have this code in my html source
<body>
<a class="android">back to home page</a>
<body>
I want to say if android phone click "back to home page" button href= "maysite.com"
else href= "your site"
I want to use inline source js in my html document

Related

Automatically close a popup

I have a wordpress website and I created a popup which has a button that links to Calendly popup. So, when I click on the button, it opens calendly popup in the background but doesnt closes the first popup automatically.
Here is the code I have embedded in the plugin---
<link href="https://assets.calendly.com/assets/external/widget.css" rel="stylesheet">
<script src="https://assets.calendly.com/assets/external/widget.js" type="text/javascript" async></script>
<a href="" onclick="Calendly.initPopupWidget({url: 'https://calendly.com/#'});return false;">
<form action="onclick="closeSelf()"">
<input type="submit" value="Schedule a Demo" />
</form>
</a>
In Angular and javascript first declare calandly
declare var Calendly: any;
Then in your function calling this one to close calendly popup window
Calendly.closePopupWidget();

How can javascript rewrite <a href=#x> to be absolute based on the current URL location instead of relative because we are using <base>?

If I have a page http://www.example1.com/foo/test.html as follows:
<head>
<base href=http://www.example2.com/>
</head>
<body>
<a href=#foo>foo</a>
...
<a name=foo />
</body>
Then when I click "foo" it takes me to http://www.example2.com/#foo instead of http://www.example1.com/foo/test.html#foo .
Question:
How do I write an onClick hook (or similar) so that the href is re-written to be absolute to the current page so that it goes to the "correct" location of http://www.example1.com/foo/test.html#foo ?

Opening new external URL as Pop up in frame(not iframe) using Jquery from area tag (generated from SSRS Report)

I have an area control which is having href="http://google.com" I want to open this URL as pop in frame.
Area code is as follows:
<area tabindex="61" alt="" id="ar1" title="" href="http://google.com"
style="text-decoration:none;" target="_top" shape="poly"
coords="123,169,123,237,146,237,146,169"></area>
I am not generating any area control. The area control is being generated from SSRS report and this SSRS report is not assigning any id for area.
I have googled a lot but does not get success so I have posted it here.
SSRS is generating report like the below image.
.
SSRS is generating dynamic URL and each bar having different URL and it may be any server name in the globe (e.g. 1 bar has URL of google another has URL of apple)
you can use like this... I am giving a theme how can you achieve this...
<html>
<head>
<title>Test IFrame SRC by Javascript </title>
<script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
<script>
$(document).ready(function () {
$("#button").click(function () {
$("#frame").attr("src", "http://www.dotnetschools.com/");
})
});
</script>
</head>
<body>
<div id="mydiv">
<iframe id="frame" src="" width="100%" height="300"></iframe>
</div>
<button id="button">Load</button>
</body>
</html>
As you can see on above example on button click, I am opening a url inside a iframe. you can just do that.
Thanks
I have removed target="_top" and it start working for me.
This application having too many Frame, frameset & iframe nesting. somewhere it was causing issue due to target="_top".

pycco (markdown doc generator), how-to embed an js (knowl) anchor?

I am working with pycco, and would like to embed a knowl, as part of the doc-html.
I am able to render doc-html directly if they are simply input as markdown comments.
ie #<div>hi<div> will correctly display in the doc-html.
I insert the javascript through the comments:
"""
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js">
</script>
<link href="http://aimath.org/knowlstyle.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://aimath.org/knowl.js"></script>
"""
However, when I insert a knowl anchor, <a knowl="/knowl/k1.html">knwl1</a>, the element opens/closes in the correct area; but, the contents of the linked html are not visible.
If I try styling the anchor (in some pycco-like manner) then the element spans the entire page and won't open or close in the right area. The html content doesn't display either.
<td class=docs>
<div class="octowrap">
<a class="octothorpe" href="#section-7">#</a>
</div>
<a knowl="/knowl/k1.html">knowli.</a>
</td>

.Js file could not be called from linked html file- JQuery mobile

I'm using Jquery mobile framework. I have 2 html files which has two buttons each. The clicking on one button will navigate to other html file. Javascript loaded in each html file will handle a click event in the HTML files. Problem here is , .JS loaded from second html file which is navigated from first html file could not be called. It shows error.
Error: p.attr("href") is undefined
Source File: file:///Users/Aspire/Development/JQuery%20Mobile/sample/jquery.mobile-1.0a2.min.js
Line: 96
What's going wrong?
Edited: test.html
html-tags. Under Headertag
<link rel="stylesheet" href="jquery.mobile-1.0a2.min.css" />
<script src="jquery-1.4.4.min.js"></script>
<script src="jquery.mobile-1.0a2.min.js"></script>
<script type="text/javascript">
$(function(){
$('#test').click(function(){
alert('This is a general button!');
});
});
</script>
<Bodytag>
<div data-role="content">
<div data-role="page">
<a id="test" data-role="button" data-inline="true" data-theme="b">Click here</a>
<a href="~Development/JQuery Mobile/sample/test2.html" data-role="button" data-inline="true" >Navigate to two</a>
</div>
</div>
</Bodytag>
In the second html. test2.html
html-tags. Under Headertag
<link rel="stylesheet" href="jquery.mobile-1.0a2.min.css" />
<script src="jquery-1.4.4.min.js"></script>
<script src="jquery.mobile-1.0a2.min.js"></script>
<script type="text/javascript">
$(function(){
$('#test2').click(function(){
alert('This is a general button!');
});
});
</script>
<Bodytag>
<div data-role="content">
<div data-role="page">
<a id="test2" data-role="button" data-inline="true" data-theme="b">Click here</a>
<a href="~Development/JQuery Mobile/sample/test.html" data-role="button" data-inline="true" >Navigate to two</a>
</div>
</div>
</Bodytag>
It works fine when test2.html is opened separately in browser. Even after returning to test.html, it gives same error. Javascript is not called. i.e. only one time, Javascript works fine when .html is launched for first time. After navigation to other page, Javascript is not called.
I ran into the same problem, the javascript in second html just doesn't run. I worked-around the problem by adding rel="external" to force unload.
i.e.
Click here
Hope this works for you too.
Clement's answer helped, because there was no ajax call replacing your link.
A normal link (without rel=exteral) is being fetched with ajax call and only the body is taken and added to DOM of the current page.
That's why your js willnot be called.
All js must be linked to all pages in external files.

Categories