Apache add Content of a Link to response - apache

I want to know if it is possible to let apache substitue a link in the html I return to the client with the html of the site behind the link.
So instead of
<html>
<head>
</head>
<body>
Link
</body>
</html>
I want something like this:
<html>
<head>
</head>
<body>
// the html of the page behind the link
</body>
</html>
I can´t use javascript or php or anything, let´s assume I only have html.IFrames are as well no solution for my problem.

Just for everyone that comes to a similar situation, Ulrich Schwarz gave a good hint with SSIs, which is in this scenario the only way that could work. However, due to cancelling the project, I was not able to validate the usage of SSI for this scenario.

This can be little painful to do and might not be suitable for all cases but you can maintain a plaintext file for every html page you want to show source of and add a link to that file instead.
For eg: Instead of <a href='somefile.html'>Click</> do <a href='somefile.source'>Click</>
where somefile.source is the copy of the somefile.html. Add triple qoutes """ in the first and the last line of the file. I didn't try a lot of combinations but this works for fairly decent html codes.

Related

Body background style not working in google chrome?

So keeping it simple, I am trying to add a background image to the entire body of a basic software I am designing.
From what it seems, when I use Adobe Dreamwaver (which allows you to see both the code and the live page), there seems to be no issue with the background image, however, when I open the file using localhost (via XAAMP) on Google Chrome, it doesn't load the image.
The specific piece of code, is as follows:
<!doctype html>
<html>
<head>
</head>
<body style="background: url('file:///C:/xampp/htdocs/Mind%20Notes/gradient.jpeg')no-repeat
center center fixed;">
</body>
</html>"
Really basic, but just to illustrate. I have tried using the body-style segment in my main code, but it didn't work. I tried the code, as above, and still got nothing.
I suspect, its an issue with my browser, not any conflicting code, otherwise the simple code above would have worked.
Many thanks
T

What is the best way to embed a SoundCloud widget in react-native-webview?

So basically as the title suggests. I have a react-native-webview component in my app and I want it to show a SoundCloud player via the SoundCloud widget. I also want to use the available methods exposed by the widget API (for example getDuration), add listeners to events, etc. I have tried 2 approaches to accomplish this, but each approach ends with a different issue that I haven't been able to resolve.
Option 1:
The source prop that I pass to the WebView is a static HTML string:
<html>
<head>
<script src="https://w.soundcloud.com/player/api.js"></script>
</head>
<body>
<iframe
id="sound-cloud-iframe"
src="${finalUri}"
>
</iframe>
</body>
</html>
That works well with the API and everything, but I can't seem to make it look good on-screen. It looks like this:
The red border marks the WebView component. I want the video to take up that entire space, which I can do with setting the width & height attributes of the iframe to 100%. The problem is, that when I do that, the elements inside the iframe retain their size (e.g the track/artist name, the progress bar at the bottom, etc). See here:
If I could somehow make it all scale by the same proportions, that would be amazing. Injecting JS scripts that scale each and every element individually seems like a bad solution.
Option 2:
The source prop that I pass to the WebView is a SoundCloud link, for example:
source={{uri: https://w.soundcloud.com/player/?visual=true&url=https%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F94546771&show_artwork=true}}
That makes the video player look just right:
But, it won't allow me to use the API exposed by SoundCloud. The reason is that, as mentioned in their API reference, there needs to be some iframe element that I need to to pass into SC.Widget in order to be able to use all the methods and listeners that I need. There is no iframe here! The HTML content that renders inside the WebView is actually the exact inner document that would render inside the iframe if I used the static HTML that I put in Option 1. If I could make the API work like that somehow, that would be amazing.
So, basically, I'm wondering which option presents the more-easily-solved issue, if they're solvable at all. Any help would be much appreciated.
Solved, used this static HTML:
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://w.soundcloud.com/player/api.js"></script>
</head>
<body>
<iframe
id="sound-cloud-iframe"
src="${finalUri}"
scrolling="no"
style="width: 100%; height: 100%;"
>
</iframe>
</body>
</html>
The meta tag was the key to success here (https://www.w3schools.com/css/css_rwd_viewport.asp)

Vue.js - Friendly syntax without compilation templates

Vue.js is ideal library for my case, but I use it on non-SPA page.
Is there a way to bypass syntax v-bind:click? I would like the attributes starts from data-v-* and don't contains :.
My solution (based on accepted answer):
It looks like Vue.js will not pass the exam here.
Knockout proved to be the ideal library for friendly SEO html syntax without compilation templates.
You can use script templates to "hide" your Vue-HTML from the validator. The following validates as HTML5.
<!DOCTYPE html>
<html>
<head>
<title>Whatever</title>
</head>
<body>
<script id="some-template" type="text/template">
<div v-model="foo" v-bind:click="dontCare">Whatever</div>
</script>
<some-template id="app"></some-template>
</body>
</html>
This is not as much of a cheat as it might seem, since Vue-HTML is not HTML, but is in fact a template used for generating HTML (or, I think more accurately, for generating the DOM). But it is a complete cheat in the sense that the generated HTML is never subjected to the validator. :)
Alternatively, you could look at using Knockout, which uses pure HTML5 (what you write is what is delivered to the browser). It is not as performant as Vue, but it is an MVVM framework.
Short answer is: No.
I don't think there is a way to change the templating of Vue. The generated HTML shipped to user will be valid, because modifiers (v-for, v-bind, etc.) will be stripped of your HTML. Framework like Angular, for example, does not strip the multiple "ng-*" properties. For instance, you could write:
<div v-if="model.length" />
The resulting html will be:
<div />
Which is valid and compatible with any W3C validator.

Apache Velocity "main template"?

I'm very new to Apache Velocity, and I'm having a little trouble figuring out the optimal way to structure my templates. In most of the guides I have seen the pages have been built like this:
#parse("header.vm")
<body>
...
</body>
#parse("footer.vm")
I have also seen someone come close to a "main" template with this approach:
<head>
...
</head>
<body>
#if($activeTab=="home")
#parse("home.vm")
#elseif($activeTab=="aboutus")
#parse("aboutus.vm")
...and so on.
</body>
Which seems a little silly, but I guess it works.
I've used Twirl a lot, so I might be spoiled, but I'd like to inject a template into another, essentially ending up with a main template like this:
<head>
...
</head>
<body>
$content
</body>
And then writing every other template as:
#parse(main){
TEMPLATE CONTENT
}
Is this possible in Velocity? If yes, is it bad practice, and if so why?
Thanks.
Velocity itself doesn't provide good support to layout template (the main template as you called). However they provide a tool called Velocity Layout Servlet (VLS).
To give you a heads up, some other templating solution like Rythm provides very nice template layout management via the template inheritance mechanism (demo). Disclaimer: I am the author of Rythm so I might have some bias here. However you can checkout this article created by a third party to understand the pros and cons of different template solutions.
You can use the $!bodyContent variable.
mainLayout.vm:
#macro(mainLayout)
<head>
...
</head>
<body>
$!bodyContent
</body>
#end
index.vm:
##mainLayout()
<h1>Index page</h1>
#end

web agent can redirect to the top target?

I'm calling from an iframe an agent that should redirect the user to a given page on the whole page.
It's a lotus script agent that do his stuff and then redirect using a common:
Print "[http://www.server.com/db.nsf/simpleForm?OpenForm]"
How could I mention the TARGET (_top in my case) ?
thanks,
Since no better response had been given, I share my Javascript solution (comment welcome):
Print |<html>
<head>
<script language="JavaScript" type="text/javascript">
<!--
window.top.location.href = "/myDB.nsf/MyFullRedirectedPage?OpenForm&L=|+lang+....+ |";
// -->
</script>
</head>
<body "style=\"margin:0 ; background:transparent\"">
processing... please wait! N.B. this text will appear very short time.
</body>
</html>|
I put a background:transparent since I'm in a iframe.
I don't love this code almost flashing before the whole page is being refreshed.