Is it possible to embed ASP.NET app in WordPress? - javascript

I have currently a site in wordpress https://example.com/. Through a "support" page our clients can access a web app at external link www2.example.com/apps/etc.
This process happens with a simple button that opens the app in a new tab.
<div align="center">
<button class="button" type="button"
onclick="alert('The application will open in a new window');openResetEn()">Open App</button>
</div>
<script type="text/javascript">
function openResetEn() {
window.open("http://www2.example.com/",'targetWindow','toolbar=no,scrollbars=no,resizable=yes,width=760,height=520');
}
</script>
The problem is that i want to keep secret the link from the majority of users that access it.
For example I was thinking if I can open it in a new window that does not shows the link, but I discovered that isn't possible (or is it?).
Then I thought that maybe I can the app inside the site.
<button class="button" type="button" onclick="displayIframe();">The app will open</button>
<div id="iframeDisplay"></div>
</div>
<script type="text/javascript">
function displayIframe() {
document.getElementById("iframeDisplay").innerHTML =
\"<iframe sandbox=\"allow-same-origin allow-scripts allow-popups allow-forms\"
src=\"http://www2.example.com/\"
style=\"border:2px solid blue;overflow:hidden;height:520px;width:760px;\"
scrolling=\"no\" ></iframe>";
}
</script>
But I can't get it to work.
And the reason behind that (i think) is that the site is running at php and the app c#. I found out that you can ran the whole site under asp.net (?!) (PeachPie/WP.NET).
How can I run the app inside the site?

Related

How to hide/display survey pop up based on url bar?

There are 2 applications. My application is written using Angular as front end http://test.com/search. My application contains javascript text which pop-ups survey whenever user visit our website.
There is another application B say - http://test.com/search?dodhaLink=true from where user can access my application too.
What I am trying to achieve is when my application is called from application B then dont show pop-up window.
Qualtrics javascript text in .html file
<div>
<!--BEGIN QUALTRICS WEBSITE FEEDBACK SNIPPET-->
<script type='text/javascript'>
(function(){var g=function(e,h,f,g){
this.get=function(a){for(var a=a+"=",c=document.cookie.split(";"),b=0,e=c.length;b<e;b++){for(var d=c[b];" "==d.charAt(0);)d=d.substring(1,d.length);if(0==d.indexOf(a))return d.substring(a.length,d.length)}return null};
this.set=function(a,c){var b="",b=new Date;b.setTime(b.getTime()+6048E5);b="; expires="+b.toGMTString();document.cookie=a+"="+c+b+"; path=/; "};c=a[1];if(100==c)return!0;switch(a[0]){case "v":return!1;case "r":return c=a[2]%Math.floor(100/c),a[2]++,this.set(f,a.join(":")),!c}return!0};
try{(new g(100,"r","QSI_S_ZN_cwOHfLkxRr4n4W2","https://zncwohflkxrr4n4w2-nlmenterprise.siteintercept.qualtrics.com/SIE/?Q_ZID=ZN_cwOHfLkxRr4n4W2")).start()}catch(i){}})();
</script><div id='ZN_cwOHfLkxRr4n4W2'><!--DO NOT REMOVE-CONTENTS PLACED HERE--></div>
<!--END WEBSITE FEEDBACK SNIPPET-->
</div>
You can use window.location.href in order to check the URL of the page from javascript.
so you can try:
if('http://test.com/search'.equals(window.location.href))
{
// display survey
}

Masterpass make redirect occur in iframe or prevent navigation

I am attempting to integrate masterpass into an existing .net application. I have followed their documentation but i would like instead of clicking on the masterpass button and being redirected to their sign in page for authentication that their login page open in either a popup or an iframe so that the user is not forced to leave my checkout page. Has anyone had any luck with this? Their page states that express checkout which is essentially what i am looking for is not available in the US or Canada. Has anyone found a work around?
My code looks like this
$(document).ready(function() {
$('#clickMe').click(function () {
masterpass.checkout({
“checkoutId”:”my checkoutId”,
“allowedCardTypes”:[“amex”,”visa”, “etc”],
“amount”:”30.00”
“currency”:”USD”
});
});
});
<script src="https://sandbox.masterpass.com/integration/merchant.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div>
My Form
<img alt="Checkout with Masterpass" role="button" src="https://static.masterpass.com/dyn/img/btn/global/mp_chk_btn_147x034px.svg" id="clickMe"/>
</div>

Passing data from tab 1 to tab 2

I'm new to stackoverflow and I came here because I couldn't find clear answers to my problems with html and javascript.
I'm wanting to display an HTML page with 3 buttons and the buttons will execute 3 scripts onClick. I need tab#1 to talk to tab#2 to execute the code but I'm stuck on how I go about doing that - here's my HTML code:
<!DOCTYPE html>
<html>
<body>
<!-- START STAGE 1 -->
<script>
function stage1()
{
// Here I want to open up a new tab so I'd do:
window.open('http://webpage.com', '_blank');
}
</script>
<!-- START STAGE 2 -->
<script>
function stage2()
{
// From here, I want to execute some JavaScript to the new tab I've opened
}
</script>
<!-- START STAGE 3 -->
<script>
function stage3()
{
// Again, I want to execute another script on the new tab I've opened
}
</script>
<button type="button" onClick="stage1()">STAGE1</button>
<hr />
<button type="button" onClick="stage2()">STAGE2</button>
<hr />
<button type="button" onClick="stage3()">STAGE3</button>
</body>
</html>
I'd be very appreciated if someone could re-write this code and leave a space in the 3 's for my code to go to be executed on tab#2 from tab#1.
Thank you in advance! - Sorry, I'm a bit of a noob haha.
Cheers,
Declan Land
It won't be straightforward, but I think you could do it with a "proxy" page that displays the intended site (Twitter) in an iframe and runs the scripts you need when you pass a parameter in the address (e.g., proxy.htm?action=step2 ) or even use a separate dedicated proxy page (proxy2.htm) for each step.
But in order for this to work, I believe you need to use a custom name for the target of your anchor links (a target="proxy_twitter"), so all links open in the same tab.
A possible issue would be that the 2nd tab would reload the proxy page on each click, but maybe this can be avoided by changing the parameters to be hashtags (proxy.htm#action=step2).
I myself don't have any experience with this mechanism, but I've seen it used on some sites.

Passing Javascript To a Redirected Web page

The code I want to run upon triggeting the redirect, is to go to another web page (or local html file, either is possible in this situation), however pass some javascript to run on that page, as that page works off embeding content in Iframes. This needs to be done to allow me to specify the content in the iframe upon redirect.
To put it simpler. How can I make it so when you go to website.com/about/, it redirects to website.com/ with the content for /about/ loaded in an iframe?
<head>
<title> CodeBundle </title>
<script>
function home() {document.getElementById("loadedpage").src="home.html";}
function about() {document.getElementById("loadedpage").src="about.html";}
function reviews() {document.getElementById("loadedpage").src="reviews.html";}
function tutorials() {document.getElementById("loadedpage").src="tutorials.html";}
function blog() {document.getElementById("loadedpage").src="blog.html";}
</script>
</head>
<body>
<header>
<br><hr><font size=27><a onClick="home();">Code Bundle</a></font><br><hr>
<div ALIGN=RIGHT>
<font size=6> | <a onClick="about();">About</a> | <a onClick="reviews();">Reviews</a> | <a onClick="tutorials();">Tutorials</a> | <a onClick="blog();">Blog<a> |</font> <hr>
</div>
<iframe id="loadedpage" src=home.html width=100% height=100% frameborder=0>Iframe Failed to Load</iframe>
</header>
</body>
</body>
this is my index.html for website.com/
I want to write a page so that when you go to website.com/about/ it redirects to website.com/ running the javascript function about(), so as to display the about page.
You will have to either pass some data using a query parameter or a fragment identifier.
See:
http://en.wikipedia.org/wiki/Query_string
http://en.wikipedia.org/wiki/Fragment_identifier
In either case you will have something present in the url and it will look like:
http://www.example.com/?page=about
or:
http://www.example.com/#about
or - this would be best:
http://www.example.com/#!/about
because it could let you make the website crawlable. See:
Making AJAX Applications Crawlable
Now after reading your comment to the answer by theredled that you "add new content regularly and loading that in embeded iframes is quicker than writing new html every time" I have to ask this: aren't you using a templating system in your website?
Keep in mind that making AJAX-loaded content and using fragment identifiers to display the right content is not done because the page creation is easier (it isn't) but because the user experience is faster and more responsive. See for example the website for the SoundJS library:
http://www.createjs.com/#!/SoundJS
When you click the link to PreloadJS at the top you go to:
http://www.createjs.com/#!/PreloadJS
The content is reloaded, the address bar changes, but the page is actually not reloaded. (You can see that it is properly crawlable because it shows in the results if you google for ReloadJS.)
Pass content by a user session ?
However, it's a quite dirty case, maybe you already know that :)

Forcing a popup to the foreground

I'm wondering if people can help me or if my way of thinking wont work. I am not a coder so I don't get to involved in writing, just learn as I go.
I have web page one that refreshes every 5 mins. This page launches a popup.
<script type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
</head>
<body önload="MM_openBrWindow('call_notice.html','CallWaiting','width=200,height=200')">"
Now if this page is currently in the background the popup also appears in the background. I need this page to come to the foreground to notify the user that the pages has refreshed. Popup has the following code:
<i>
<body onblur="self.focus()" önload="self.focus()">
<p align="center" class="style1">You have a call. </p>
<p align="center" class="style1">Please close this window to continue.</p>
<p align="center" class="style1"> </p>
<form method="post">
<div align="center">
<input type="button" value="Continue"
ö'nclick="window.close()">
</div>
</form>
</i>
I have tried set.focus seen some setforegroundwindow, but can't get it to work. Seen z-order but that doesn't make sens to me.
Has any one got any ideas on how I can do it, or has something that monitors windows titles and executes something?
Any help would be great. I don't write from scratch but take bits here and there just to let you now what type of person you are dealing with.
Basically I want the popup to popup in front of all windows when the web pages at the back (which could 4 programs back) refreshes. Not sure how to paste the code.
yourpopupwindow.focus() should work. That's in javascript, have no idea about vbsript.
Like so:
function win_open(oid) {
yourpopupwindow = window.open('yoururl', 'popupwin', 'menubar=no,history=no,resizable=yes,scrollbars=yes,toolbar=no,width=600,height=300');
{yourpopupwindow.focus()}
}
Then on refresh you can either close popup if it's open and open new one and focus on it, or just focus on existing one.

Categories

Resources